You are here

function oauth2_server_test_oauth2_server_scope_access_alter in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x tests/modules/oauth2_server_test/oauth2_server_test.module \oauth2_server_test_oauth2_server_scope_access_alter()

Implements hook_oauth2_server_scope_access_alter().

File

tests/modules/oauth2_server_test/oauth2_server_test.module, line 33
Support module for OAuth2 Server testing.

Code

function oauth2_server_test_oauth2_server_scope_access_alter(&$context) {
  if ($context['server']
    ->id() == 'test_server') {

    // We have to loop through the scopes because the actual ids are
    // prefixed with the server id.
    foreach ($context['scopes'] as $id => $scope) {
      if ($scope->scope_id == 'forbidden') {
        unset($context['scopes'][$id]);
      }
    }
  }
}