You are here

function rac_user_role_delete in Role Access Control 8

Same name and namespace in other branches
  1. 8.2 rac.module \rac_user_role_delete()

Implements hook_user_role_delete().

On Role deletion, revoke RAC update permission from other roles.

File

./rac.module, line 165
Module providing role access relations.

Code

function rac_user_role_delete(EntityInterface $role) {
  $roles = user_roles();
  $permission = "RAC_update_" . $role
    ->id();
  foreach ($roles as $r) {
    if ($r
      ->hasPermission($permission)) {
      $r
        ->revokePermission($permission);
    }
  }
}