diff --git a/app/app.php b/app/app.php index fe51e4a7f..e92660b5a 100644 --- a/app/app.php +++ b/app/app.php @@ -50,7 +50,7 @@ $clients = \array_unique(\array_merge($clientsConsole, \array_map(function ($nod return false; })))); -$utopia->init(function () use ($utopia, $request, $response, &$user, $project, $console, $webhook, $mail, $audit, $usage, $clients, &$mode) { +$utopia->init(function () use ($utopia, $request, $response, &$user, $project, $console, $webhook, $mail, $audit, $usage, $clients) { $route = $utopia->match($request); @@ -160,7 +160,7 @@ $utopia->init(function () use ($utopia, $request, $response, &$user, $project, $ $role = Auth::USER_ROLE_APP; $scopes = \array_merge($roles[$role]['scopes'], $key->getAttribute('scopes', [])); - $mode = APP_MODE_SERVER; + Authorization::setDefaultStatus(false); // Cancel security segmentation for API keys. } diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 90301656a..8aa6383fd 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -51,7 +51,7 @@ $utopia->post('/v1/teams') throw new Exception('Failed saving team to DB', 500); } - if ($mode !== APP_MODE_ADMIN && $user->getId()) { // Don't add user on server mode + if ($mode !== APP_MODE_ADMIN && $user->getId()) { // Don't add user on app/server mode $membership = new Document([ '$collection' => Database::SYSTEM_COLLECTION_MEMBERSHIPS, '$permissions' => [ @@ -288,7 +288,7 @@ $utopia->post('/v1/teams/:teamId/memberships') } } - if (!$isOwner && (APP_MODE_ADMIN !== $mode) && (APP_MODE_SERVER !== $mode)) { + if (!$isOwner && (APP_MODE_ADMIN !== $mode) && $user->getId()) { // Not owner, not admin, not app (server) throw new Exception('User is not allowed to send invitations for this team', 401); } diff --git a/app/init.php b/app/init.php index 4a54918a0..327bfbab6 100644 --- a/app/init.php +++ b/app/init.php @@ -31,7 +31,6 @@ const APP_EMAIL_TEAM = 'team@localhost.test'; // Default email address const APP_EMAIL_SECURITY = 'security@localhost.test'; // Default security email address const APP_USERAGENT = APP_NAME.'-Server v%s. Please report abuse at %s'; const APP_MODE_ADMIN = 'admin'; -const APP_MODE_SERVER = 'server'; const APP_PAGING_LIMIT = 15; const APP_CACHE_BUSTER = 125; const APP_VERSION_STABLE = '0.6.2';