You are here

function Scope::checkScope in OAuth2 Server 7

Check if everything in required scope is contained in available scope.

Parameters

string $required_scope: A space-separated string of scopes.

Return value

bool TRUE if everything in required scope is contained in available scope, and FALSE if it isn't.

See also

http://tools.ietf.org/html/rfc6749#section-7

File

lib/Drupal/oauth2_server/Scope.php, line 33

Class

Scope
Provides a scope-checking utility to the library.

Namespace

Drupal\oauth2_server

Code

function checkScope($required_scope, $available_scope) {
  $required_scope = explode(' ', trim($required_scope));
  $available_scope = explode(' ', trim($available_scope));
  return count(array_diff($required_scope, $available_scope)) == 0;
}