function user_role_revoke_permissions
Same name in other branches
- 7.x modules/user/user.module \user_role_revoke_permissions()
- 9 core/modules/user/user.module \user_role_revoke_permissions()
- 8.9.x core/modules/user/user.module \user_role_revoke_permissions()
- 10 core/modules/user/user.module \user_role_revoke_permissions()
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()
11 calls to user_role_revoke_permissions()
- CommentAnonymousTest::testAnonymous in core/
modules/ comment/ tests/ src/ Functional/ CommentAnonymousTest.php - Tests anonymous comment functionality.
- CommentBlockTest::testRecentCommentBlock in core/
modules/ comment/ tests/ src/ Functional/ CommentBlockTest.php - Tests the recent comments block.
- ContactPersonalTest::testPersonalContactAccess in core/
modules/ contact/ tests/ src/ Functional/ ContactPersonalTest.php - Tests access to the personal contact form.
- ContactSitewideTest::testSiteWideContact in core/
modules/ contact/ tests/ src/ Functional/ ContactSitewideTest.php - Tests configuration options and the site-wide contact form.
- FileFieldWidgetTest::testPrivateFileComment in core/
modules/ file/ tests/ src/ Functional/ FileFieldWidgetTest.php - Tests that download restrictions on private files work on comments.
File
-
core/
modules/ user/ user.module, line 608
Code
function user_role_revoke_permissions($rid, array $permissions = []) {
// Revoke permissions for the role.
$role = Role::load($rid);
foreach ($permissions as $permission) {
$role->revokePermission($permission);
}
$role->trustData()
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.