public function UserAccessControlHandlerTest::userNameProvider in Drupal 9
Same name and namespace in other branches
- 8 core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php \Drupal\Tests\user\Unit\UserAccessControlHandlerTest::userNameProvider()
Provides test data for testUserNameAccess().
File
- core/
modules/ user/ tests/ src/ Unit/ UserAccessControlHandlerTest.php, line 169
Class
- UserAccessControlHandlerTest
- Tests the user access controller.
Namespace
Drupal\Tests\user\UnitCode
public function userNameProvider() {
$name_access = [
// The viewer user is allowed to see user names on all accounts.
[
'viewer' => 'viewer',
'target' => 'viewer',
'view' => TRUE,
'edit' => FALSE,
],
[
'viewer' => 'owner',
'target' => 'viewer',
'view' => TRUE,
'edit' => FALSE,
],
[
'viewer' => 'viewer',
'target' => 'owner',
'view' => TRUE,
'edit' => FALSE,
],
// The owner user is allowed to change its own user name.
[
'viewer' => 'owner',
'target' => 'owner',
'view' => TRUE,
'edit' => TRUE,
],
// The users-administrator user has full access.
[
'viewer' => 'admin',
'target' => 'owner',
'view' => TRUE,
'edit' => TRUE,
],
];
return $name_access;
}