function ResourceTestBase::revokePermissionsFromTestedRole
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::revokePermissionsFromTestedRole()
- 8.9.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::revokePermissionsFromTestedRole()
- 11.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::revokePermissionsFromTestedRole()
Revokes permissions from the authenticated role.
Parameters
string[] $permissions: Permissions to revoke.
2 calls to ResourceTestBase::revokePermissionsFromTestedRole()
- CommentTest::testCollectionFilterAccess in core/
modules/ jsonapi/ tests/ src/ Functional/ CommentTest.php - NodeTest::testCollectionFilterAccess in core/
modules/ jsonapi/ tests/ src/ Functional/ NodeTest.php
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php, line 670
Class
- ResourceTestBase
- Subclass this for every JSON:API resource type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function revokePermissionsFromTestedRole(array $permissions) {
$role = Role::load(RoleInterface::AUTHENTICATED_ID);
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.