function UserAccessControlHandlerTest::userNameProvider

Same name in other branches
  1. 8.9.x core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php \Drupal\Tests\user\Unit\UserAccessControlHandlerTest::userNameProvider()
  2. 10 core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php \Drupal\Tests\user\Unit\UserAccessControlHandlerTest::userNameProvider()
  3. 11.x 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 168

Class

UserAccessControlHandlerTest
Tests the user access controller.

Namespace

Drupal\Tests\user\Unit

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.