From 09d30ec249429050de0fc46829341c6e276b4a18 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 27 Jun 2022 14:51:43 +1200 Subject: [PATCH] Fix role clobbering for error messages --- app/controllers/general.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 747799e369..7049d26539 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -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); }