chore: add admin mode assertion for create collection
This commit is contained in:
parent
4706e6580d
commit
6fc176d508
1 changed files with 2 additions and 1 deletions
|
@ -718,11 +718,12 @@ App::post('/v1/databases/:databaseId/collections')
|
|||
->inject('response')
|
||||
->inject('dbForProject')
|
||||
->inject('events')
|
||||
->inject('mode')
|
||||
->action(function (string $databaseId, string $collectionId, string $name, ?array $permissions, bool $documentSecurity, bool $enabled, Response $response, Database $dbForProject, Event $events) {
|
||||
|
||||
$database = Authorization::skip(fn() => $dbForProject->getDocument('databases', $databaseId));
|
||||
|
||||
if ($database->isEmpty() || (!$database->getAttribute('enabled'))) {
|
||||
if ($database->isEmpty() || (!$database->getAttribute('enabled') && $mode !== APP_MODE_ADMIN)) {
|
||||
throw new Exception(Exception::DATABASE_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue