1
0
Fork 0
mirror of synced 2024-10-01 01:37:56 +13:00

Fix role clobbering for error messages

This commit is contained in:
Jake Barnby 2022-06-27 14:51:43 +12:00
parent 0f0654d49e
commit 09d30ec249

View file

@ -292,11 +292,11 @@ App::init(function (App $utopia, Request $request, Response $response, Document
$service = $route->getLabel('sdk.namespace', '');
if (!empty($service)) {
$roles = Authorization::getRoles();
$serviceRoles = Authorization::getRoles();
if (
array_key_exists($service, $project->getAttribute('services', []))
&& !$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);
}