user_role_revoke_permissions

user_role_revoke_permissions($rid, array $permissions = array())

Revoke permissions from a user role.

Parameters

mixed $rid: The ID of a user role to alter.

array $permissions: (optional) A list of permission names to revoke.

See also

user_role_change_permissions()

user_role_grant_permissions()

File

core/modules/user/user.module, line 1160
Enables the user registration and login system.

Code

function user_role_revoke_permissions($rid, array $permissions = array()) {
  // Revoke permissions for the role.
  $role = Role::load($rid);
  foreach ($permissions as $permission) {
    $role->revokePermission($permission);
  }
  $role->trustData()->save();
}
doc_Drupal
2016-10-29 09:53:20
Comments
Leave a Comment

Please login to continue.