mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Move OAuth admin request check after key auth
This commit is contained in:
1 file changed
+8
-7
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user