Set user roles at app init
This commit is contained in:
parent
416d767ff0
commit
e6a4020fd1
|
@ -180,6 +180,8 @@ $utopia->init(function () use ($utopia, $request, $response, &$user, $project, $
|
|||
}
|
||||
}, $user->getAttribute('memberships', []));
|
||||
|
||||
$user->setAttribute('roles', Authorization::getRoles());
|
||||
|
||||
// TDOO Check if user is god
|
||||
|
||||
if (!\in_array($scope, $scopes)) {
|
||||
|
|
|
@ -709,15 +709,7 @@ $utopia->patch('/v1/account/name')
|
|||
->setParam('resource', 'users/'.$user->getId())
|
||||
;
|
||||
|
||||
$response->json(\array_merge($user->getArrayCopy(\array_merge(
|
||||
[
|
||||
'$id',
|
||||
'email',
|
||||
'registration',
|
||||
'name',
|
||||
],
|
||||
$oauth2Keys
|
||||
)), ['roles' => Authorization::getRoles()]));
|
||||
$response->dynamic($user);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -751,15 +743,7 @@ $utopia->patch('/v1/account/password')
|
|||
->setParam('resource', 'users/'.$user->getId())
|
||||
;
|
||||
|
||||
$response->json(\array_merge($user->getArrayCopy(\array_merge(
|
||||
[
|
||||
'$id',
|
||||
'email',
|
||||
'registration',
|
||||
'name',
|
||||
],
|
||||
$oauth2Keys
|
||||
)), ['roles' => Authorization::getRoles()]));
|
||||
$response->dynamic($user);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -809,15 +793,7 @@ $utopia->patch('/v1/account/email')
|
|||
->setParam('resource', 'users/'.$user->getId())
|
||||
;
|
||||
|
||||
$response->json(\array_merge($user->getArrayCopy(\array_merge(
|
||||
[
|
||||
'$id',
|
||||
'email',
|
||||
'registration',
|
||||
'name',
|
||||
],
|
||||
$oauth2Keys
|
||||
)), ['roles' => Authorization::getRoles()]));
|
||||
$response->dynamic($user);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue