You are here

function user_role_revoke_permissions in Drupal 7

Same name and namespace in other branches
  1. 8 core/modules/user/user.module \user_role_revoke_permissions()
  2. 9 core/modules/user/user.module \user_role_revoke_permissions()

Revoke permissions from a user role.

Parameters

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

$permissions: A list of permission names to revoke.

See also

user_role_change_permissions()

user_role_grant_permissions()

5 calls to user_role_revoke_permissions()
CommentBlockFunctionalTest::testRecentCommentBlock in modules/comment/comment.test
Test the recent comments block.
ContactPersonalTestCase::testPersonalContactAccess in modules/contact/contact.test
Tests access to the personal contact form.
ContactSitewideTestCase::testSiteWideContact in modules/contact/contact.test
Tests configuration options and the site-wide contact form.
NodeAdminTestCase::setUp in modules/node/node.test
Sets up a Drupal site for running functional and integration tests.
user_role_change_permissions in modules/user/user.module
Change permissions for a user role.

File

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

Code

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

  // Revoke permissions for the role.
  db_delete('role_permission')
    ->condition('rid', $rid)
    ->condition('permission', $permissions, 'IN')
    ->execute();

  // Clear the user access cache.
  drupal_static_reset('user_access');
  drupal_static_reset('user_role_permissions');
}