You are here

function _social_gdpr_set_permissions in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 modules/custom/social_gdpr/social_gdpr.install \_social_gdpr_set_permissions()
  2. 8.2 modules/custom/social_gdpr/social_gdpr.install \_social_gdpr_set_permissions()
  3. 8.3 modules/custom/social_gdpr/social_gdpr.install \_social_gdpr_set_permissions()
  4. 8.4 modules/custom/social_gdpr/social_gdpr.install \_social_gdpr_set_permissions()
  5. 8.5 modules/custom/social_gdpr/social_gdpr.install \_social_gdpr_set_permissions()
  6. 8.6 modules/custom/social_gdpr/social_gdpr.install \_social_gdpr_set_permissions()
  7. 8.7 modules/custom/social_gdpr/social_gdpr.install \_social_gdpr_set_permissions()
  8. 8.8 modules/custom/social_gdpr/social_gdpr.install \_social_gdpr_set_permissions()
  9. 10.0.x modules/custom/social_gdpr/social_gdpr.install \_social_gdpr_set_permissions()
  10. 10.1.x modules/custom/social_gdpr/social_gdpr.install \_social_gdpr_set_permissions()
  11. 10.2.x modules/custom/social_gdpr/social_gdpr.install \_social_gdpr_set_permissions()

Function to set permissions.

1 call to _social_gdpr_set_permissions()
social_gdpr_install in modules/custom/social_gdpr/social_gdpr.install
Implements hook_install().

File

modules/custom/social_gdpr/social_gdpr.install, line 25
Install, update and uninstall functions for the social_gdpr module.

Code

function _social_gdpr_set_permissions() {

  /** @var \Drupal\user\Entity\Role $role */
  foreach (Role::loadMultiple() as $role) {
    if ($role
      ->id() !== 'administrator') {
      $permissions = _social_gdpr_get_permissions($role
        ->id());
      user_role_grant_permissions($role
        ->id(), $permissions);
    }
  }

  // Only for AN.
  user_role_grant_permissions('anonymous', [
    'without consent',
  ]);
}