1 user.module user_role_revoke_permissions($role_name, array $permissions = array())

Revoke permissions from a user role.

Parameters

string $role_name: The name of a user role to alter.

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

See also

user_role_change_permissions()

user_role_grant_permissions()

File

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

Code

function user_role_revoke_permissions($role_name, array $permissions = array()) {
  // Revoke permissions for the role.
  $user_role = user_role_load($role_name);
  $user_role->permissions = array_values(array_diff($user_role->permissions, $permissions));
  user_role_save($user_role);
}