I am using Drupal 8. I want to programmatically unselect the View published content checkbox for anonymous users.
How can I achieve this?
You have to insert this code in a hook_install() or hook_update() :
$role = \Drupal\user\Entity\Role::load('anonymous');
$role->revokePermission('your_permission');
$role->save();