You are here

public function ScopeUtility::checkScope in OAuth2 Server 2.0.x

Same name and namespace in other branches
  1. 8 src/ScopeUtility.php \Drupal\oauth2_server\ScopeUtility::checkScope()

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

Parameters

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

string $available_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

src/ScopeUtility.php, line 48

Class

ScopeUtility
Provides a scope-checking utility to the library.

Namespace

Drupal\oauth2_server

Code

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