function user_access_test_entity_create_access

Same name in other branches
  1. 8.9.x core/modules/user/tests/modules/user_access_test/user_access_test.module \user_access_test_entity_create_access()
  2. 10 core/modules/user/tests/modules/user_access_test/user_access_test.module \user_access_test_entity_create_access()
  3. 11.x core/modules/user/tests/modules/user_access_test/user_access_test.module \user_access_test_entity_create_access()

Implements hook_entity_create_access().

File

core/modules/user/tests/modules/user_access_test/user_access_test.module, line 38

Code

function user_access_test_entity_create_access(AccountInterface $account, array $context, $entity_bundle) {
    if ($context['entity_type_id'] != 'user') {
        return AccessResult::neutral();
    }
    // Account with role sub-admin can create users.
    return AccessResult::allowedIfHasPermission($account, 'sub-admin');
}

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