diff --git a/app/controllers/general.php b/app/controllers/general.php index e33bbcbd5..860d2d7c5 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -234,7 +234,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $consoleDB ]); $role = Auth::USER_ROLE_APP; - $scopes = \array_merge($roles[Auth::USER_ROLE_APP]['scopes'], $key->getAttribute('scopes', [])); + $scopes = \array_merge($roles[$role]['scopes'], $key->getAttribute('scopes', [])); Authorization::setRole('role:'.Auth::USER_ROLE_APP); Authorization::setDefaultStatus(false); // Cancel security segmentation for API keys. diff --git a/app/init.php b/app/init.php index 1bf450808..986b07b19 100644 --- a/app/init.php +++ b/app/init.php @@ -430,7 +430,7 @@ App::setResource('user', function($mode, $project, $console, $request, $response $user = $projectDB->getDocument(Auth::$unique); } else { $user = $consoleDB->getDocument(Auth::$unique); - + $user ->setAttribute('$id', 'admin-'.$user->getAttribute('$id')) ;