You are here

function _event_group_remove_risky_permissions in Event 8

Helper function to remove all risky permissions from any role.

Separated out from paranoia_permissions_submit so that there is clearly no dependency on a form or form state.

1 call to _event_group_remove_risky_permissions()
event_group_permissions_submit in modules/event_group/event_group.module
Remove extremely-risky permissions from any role.

File

modules/event_group/event_group.module, line 164
Enables Group functionality for the Event module.

Code

function _event_group_remove_risky_permissions() {
  $banned_permissions = [
    'create events group',
  ];
  $roles = Role::loadMultiple();
  foreach ($roles as $role) {
    foreach ($banned_permissions as $permission) {
      $role
        ->revokePermission($permission);
    }
    $role
      ->save();
  }
}