You are here

public function UserAccessControlHandlerTest::userNameProvider in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php \Drupal\Tests\user\Unit\UserAccessControlHandlerTest::userNameProvider()

Provides test data for estUserNameAccess().

File

core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php, line 155
Contains \Drupal\Tests\user\Unit\UserAccessControlHandlerTest.

Class

UserAccessControlHandlerTest
Tests the user access controller.

Namespace

Drupal\Tests\user\Unit

Code

public function userNameProvider() {
  $name_access = array(
    // The viewer user is allowed to see user names on all accounts.
    array(
      'viewer' => 'viewer',
      'target' => 'viewer',
      'view' => TRUE,
      'edit' => FALSE,
    ),
    array(
      'viewer' => 'owner',
      'target' => 'viewer',
      'view' => TRUE,
      'edit' => FALSE,
    ),
    array(
      'viewer' => 'viewer',
      'target' => 'owner',
      'view' => TRUE,
      'edit' => FALSE,
    ),
    // The owner user is allowed to change its own user name.
    array(
      'viewer' => 'owner',
      'target' => 'owner',
      'view' => TRUE,
      'edit' => TRUE,
    ),
    // The users-administrator user has full access.
    array(
      'viewer' => 'admin',
      'target' => 'owner',
      'view' => TRUE,
      'edit' => TRUE,
    ),
  );
  return $name_access;
}