mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Issue #3241690 by paul121: User 1 cannot use the refresh_token grant type
Load all roles for user 1 so they can be granted all possible scopes.
This commit is contained in:
parent
703f31d0e1
commit
d86c21cff2
|
@ -61,7 +61,16 @@ class FarmScopeRepository extends ScopeRepository {
|
|||
}
|
||||
|
||||
// Load the user's roles.
|
||||
$user_roles = $user->getRoles();
|
||||
// Load all roles for user 1 so they can be granted all possible scopes.
|
||||
if ((int) $user->id() === 1) {
|
||||
$user_roles = array_map(function (RoleInterface $role) {
|
||||
return $role->id();
|
||||
}, $this->entityTypeManager->getStorage('user_role')->loadMultiple());
|
||||
}
|
||||
// Else load the normal user's roles.
|
||||
else {
|
||||
$user_roles = $user->getRoles();
|
||||
}
|
||||
|
||||
// Include the user's roles if enabled.
|
||||
if ($consumer_entity->get('grant_user_access')->value) {
|
||||
|
|
Loading…
Reference in a new issue