Fix role clobbering for error messages
This commit is contained in:
parent
0f0654d49e
commit
09d30ec249
1 changed files with 2 additions and 2 deletions
|
@ -292,11 +292,11 @@ App::init(function (App $utopia, Request $request, Response $response, Document
|
||||||
|
|
||||||
$service = $route->getLabel('sdk.namespace', '');
|
$service = $route->getLabel('sdk.namespace', '');
|
||||||
if (!empty($service)) {
|
if (!empty($service)) {
|
||||||
$roles = Authorization::getRoles();
|
$serviceRoles = Authorization::getRoles();
|
||||||
if (
|
if (
|
||||||
array_key_exists($service, $project->getAttribute('services', []))
|
array_key_exists($service, $project->getAttribute('services', []))
|
||||||
&& !$project->getAttribute('services', [])[$service]
|
&& !$project->getAttribute('services', [])[$service]
|
||||||
&& !(Auth::isPrivilegedUser($roles) || Auth::isAppUser($roles))
|
&& !(Auth::isPrivilegedUser($serviceRoles) || Auth::isAppUser($serviceRoles))
|
||||||
) {
|
) {
|
||||||
throw new AppwriteException('Service is disabled', 503, AppwriteException::GENERAL_SERVICE_DISABLED);
|
throw new AppwriteException('Service is disabled', 503, AppwriteException::GENERAL_SERVICE_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue