Move OAuth admin request check after key auth

This commit is contained in:
Chirag Aggarwal committed 2026-06-25 13:41:15 +05:30
1 parent 89c27eef46
commit 0340a49bb8
1 file changed
+8 -7
+8 -7
View File
@@ -165,13 +165,6 @@ Http::init()
// Step 4: Get scopes for the role
$scopes = $roles[$role]['scopes'];
$isAdminProjectRequest = ! $user->isEmpty()
&& $project->getId() !== 'console'
&& $mode === APP_MODE_ADMIN;
$isOAuthAdminProjectRequest = ! empty($apiKey)
&& $apiKey->getType() === API_KEY_OAUTH2
&& $apiKey->getRole() === User::ROLE_OWNER
&& $isAdminProjectRequest;
// Step 5: API Key Authentication
if (! empty($apiKey)) {
@@ -376,6 +369,14 @@ Http::init()
$authorization->addRole($authRole);
}
$isAdminProjectRequest = ! $user->isEmpty()
&& $project->getId() !== 'console'
&& $mode === APP_MODE_ADMIN;
$isOAuthAdminProjectRequest = ! empty($apiKey)
&& $apiKey->getType() === API_KEY_OAUTH2
&& $apiKey->getRole() === User::ROLE_OWNER
&& $isAdminProjectRequest;
if ($isOAuthAdminProjectRequest) {
$authorization->setDefaultStatus(false);
}