diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 8e81620cf7..65ea4e0645 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -1069,9 +1069,9 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId') ->param('roles', [], function (Document $project, Database $dbForProject) { if ($project->getId() === 'console') { $roles = array_keys(Config::getParam('roles', [])); - array_filter($roles, function ($role) { + $roles = array_values(array_filter($roles, function ($role) { return !in_array($role, [Auth::USER_ROLE_APPS, Auth::USER_ROLE_GUESTS, Auth::USER_ROLE_USERS]); - }); + })); return new ArrayList(new WhiteList($roles), APP_LIMIT_ARRAY_PARAMS_SIZE); } return new ArrayList(new Key(false, $dbForProject->getAdapter()->getMaxUIDLength()), APP_LIMIT_ARRAY_PARAMS_SIZE); diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 1b1af97eca..4aa36f4702 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -233,16 +233,28 @@ class Install extends Action $mongoInitScript = __DIR__ . '/../../../../mongo-init.js'; $mongoEntrypoint = __DIR__ . '/../../../../mongo-entrypoint.sh'; - if (file_exists($mongoInitScript)) { - if (!copy($mongoInitScript, $this->path . '/mongo-init.js')) { - Console::warning('Failed to copy mongo-init.js'); - } + if (!file_exists($mongoInitScript)) { + $message = 'Required MongoDB initialization file not found: mongo-init.js'; + Console::error($message); + Console::exit(1); } - if (file_exists($mongoEntrypoint)) { - if (!copy($mongoEntrypoint, $this->path . '/mongo-entrypoint.sh')) { - Console::warning('Failed to copy mongo-entrypoint.sh'); - } + if (!copy($mongoInitScript, $this->path . '/mongo-init.js')) { + $message = 'Failed to copy mongo-init.js - this file is required for MongoDB replica set setup'; + Console::error($message); + Console::exit(1); + } + + if (!file_exists($mongoEntrypoint)) { + $message = 'Required MongoDB initialization file not found: mongo-entrypoint.sh'; + Console::error($message); + Console::exit(1); + } + + if (!copy($mongoEntrypoint, $this->path . '/mongo-entrypoint.sh')) { + $message = 'Failed to copy mongo-entrypoint.sh - this file is required for MongoDB replica set setup'; + Console::error($message); + Console::exit(1); } }