You are here

function oauth2_server_scope_access in OAuth2 Server 7

Access control for oauth2_server_scope entities.

Parameters

string $op: The operation being performed. One of 'view', 'update', 'create' or 'delete'.

object $entity: Optionally an entity to check access for. If no entity is given, it will be determined whether access is allowed for all entities of the given type.

object $account: The user to check for. Leave it to NULL to check for the global user.

string $entity_type: The entity type of the entity to check for.

Return value

bool TRUE if access is granted, FALSE otherwise.

See also

entity_access()

3 string references to 'oauth2_server_scope_access'
hook_oauth2_server_default_scope in ./oauth2_server.api.php
Returns the default scope for the provided server.
oauth2_server_entity_info in ./oauth2_server.module
Implements hook_entity_info().
Scope::scopeExists in lib/Drupal/oauth2_server/Scope.php
Check if the provided scope exists in storage.

File

./oauth2_server.module, line 443
Provides OAuth2 server functionality.

Code

function oauth2_server_scope_access($op, $entity, $account, $entity_type) {
  if ($entity) {

    // Scope access depends on server access.
    $server = oauth2_server_load($entity->server);
    return oauth2_server_access($op, $server, $account, 'oauth2_server');
  }
  return user_access('administer oauth2 server', $account);
}