1
0
Fork 0
mirror of synced 2024-05-21 05:02:37 +12:00

Added server mode

This commit is contained in:
Eldad Fux 2020-07-09 13:27:11 +03:00
parent 822a0e9297
commit edf6a5fd04
3 changed files with 4 additions and 3 deletions

View file

@ -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) {
$utopia->init(function () use ($utopia, $request, $response, &$user, $project, $console, $webhook, $mail, $audit, $usage, $clients, &$mode) {
$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.
}

View file

@ -288,7 +288,7 @@ $utopia->post('/v1/teams/:teamId/memberships')
}
}
if (!$isOwner && (APP_MODE_ADMIN !== $mode)) {
if (!$isOwner && (APP_MODE_ADMIN !== $mode) && (APP_MODE_SERVER !== $mode)) {
throw new Exception('User is not allowed to send invitations for this team', 401);
}

View file

@ -31,6 +31,7 @@ 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';