Community Documentation

user_role_revoke_permissions

7 user.module user_role_revoke_permissions($rid, array $permissions = array())
8 user.module user_role_revoke_permissions($rid, array $permissions = array())

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 functions call 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
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
user_role_change_permissions in modules/user/user.module
Change permissions for a user role.

File

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

Code

<?php
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');
}
?>
Login or register to post comments