From 539ea96ca0ab1ca48637f829e44c1d5e1630b077 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 25 Jun 2020 21:32:12 +0300 Subject: [PATCH] Adding group support, upgraded FW --- app/controllers/api/account.php | 23 ++++++++++++++++- app/controllers/api/avatars.php | 7 +++++ app/controllers/api/database.php | 11 ++++++++ app/controllers/api/graphql.php | 1 + app/controllers/api/health.php | 14 ++++++++++ app/controllers/api/locale.php | 7 +++++ app/controllers/api/projects.php | 32 +++++++++++++++++++++++ app/controllers/api/storage.php | 11 ++++++-- app/controllers/api/teams.php | 9 +++++++ app/controllers/api/users.php | 10 ++++++++ app/controllers/mock.php | 2 +- app/controllers/shared/api.php | 2 +- app/controllers/shared/web.php | 2 +- app/controllers/web/console.php | 34 ++++++++++++------------ app/controllers/web/home.php | 24 +++++++++-------- composer.json | 2 +- composer.lock | 44 ++++++++++++++++---------------- 17 files changed, 179 insertions(+), 56 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 3327ef24e..7757990c6 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -45,10 +45,11 @@ $utopia->init(function() use (&$oauth2Keys) { $oauth2Keys[] = 'oauth2'.\ucfirst($key); $oauth2Keys[] = 'oauth2'.\ucfirst($key).'AccessToken'; } -}); +}, 'account'); $utopia->post('/v1/account') ->desc('Create Account') + ->groups(['api', 'account']) ->label('webhook', 'account.create') ->label('scope', 'public') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) @@ -149,6 +150,7 @@ $utopia->post('/v1/account') $utopia->post('/v1/account/sessions') ->desc('Create Account Session') + ->groups(['api', 'account']) ->label('webhook', 'account.sessions.create') ->label('scope', 'public') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) @@ -239,6 +241,7 @@ $utopia->post('/v1/account/sessions') $utopia->get('/v1/account/sessions/oauth2/:provider') ->desc('Create Account Session with OAuth2') + ->groups(['api', 'account']) ->label('error', __DIR__.'/../../views/general/error.phtml') ->label('scope', 'public') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) @@ -289,6 +292,7 @@ $utopia->get('/v1/account/sessions/oauth2/:provider') $utopia->get('/v1/account/sessions/oauth2/callback/:provider/:projectId') ->desc('OAuth2 Callback') + ->groups(['api', 'account']) ->label('error', __DIR__.'/../../views/general/error.phtml') ->label('scope', 'public') ->label('docs', false) @@ -311,6 +315,7 @@ $utopia->get('/v1/account/sessions/oauth2/callback/:provider/:projectId') $utopia->post('/v1/account/sessions/oauth2/callback/:provider/:projectId') ->desc('OAuth2 Callback') + ->groups(['api', 'account']) ->label('error', __DIR__.'/../../views/general/error.phtml') ->label('scope', 'public') ->label('origin', '*') @@ -334,6 +339,7 @@ $utopia->post('/v1/account/sessions/oauth2/callback/:provider/:projectId') $utopia->get('/v1/account/sessions/oauth2/:provider/redirect') ->desc('OAuth2 Redirect') + ->groups(['api', 'account']) ->label('error', __DIR__.'/../../views/general/error.phtml') ->label('webhook', 'account.sessions.create') ->label('scope', 'public') @@ -528,6 +534,7 @@ $utopia->get('/v1/account/sessions/oauth2/:provider/redirect') $utopia->get('/v1/account') ->desc('Get Account') + ->groups(['api', 'account']) ->label('scope', 'account') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) ->label('sdk.namespace', 'account') @@ -551,6 +558,7 @@ $utopia->get('/v1/account') $utopia->get('/v1/account/prefs') ->desc('Get Account Preferences') + ->groups(['api', 'account']) ->label('scope', 'account') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) ->label('sdk.namespace', 'account') @@ -573,6 +581,7 @@ $utopia->get('/v1/account/prefs') $utopia->get('/v1/account/sessions') ->desc('Get Account Sessions') + ->groups(['api', 'account']) ->label('scope', 'account') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) ->label('sdk.namespace', 'account') @@ -631,6 +640,7 @@ $utopia->get('/v1/account/sessions') $utopia->get('/v1/account/logs') ->desc('Get Account Logs') + ->groups(['api', 'account']) ->label('scope', 'account') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) ->label('sdk.namespace', 'account') @@ -703,6 +713,7 @@ $utopia->get('/v1/account/logs') $utopia->patch('/v1/account/name') ->desc('Update Account Name') + ->groups(['api', 'account']) ->label('webhook', 'account.update.name') ->label('scope', 'account') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) @@ -740,6 +751,7 @@ $utopia->patch('/v1/account/name') $utopia->patch('/v1/account/password') ->desc('Update Account Password') + ->groups(['api', 'account']) ->label('webhook', 'account.update.password') ->label('scope', 'account') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) @@ -782,6 +794,7 @@ $utopia->patch('/v1/account/password') $utopia->patch('/v1/account/email') ->desc('Update Account Email') + ->groups(['api', 'account']) ->label('webhook', 'account.update.email') ->label('scope', 'account') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) @@ -840,6 +853,7 @@ $utopia->patch('/v1/account/email') $utopia->patch('/v1/account/prefs') ->desc('Update Account Preferences') + ->groups(['api', 'account']) ->label('webhook', 'account.update.prefs') ->label('scope', 'account') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) @@ -880,6 +894,7 @@ $utopia->patch('/v1/account/prefs') $utopia->delete('/v1/account') ->desc('Delete Account') + ->groups(['api', 'account']) ->label('webhook', 'account.delete') ->label('scope', 'account') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) @@ -935,6 +950,7 @@ $utopia->delete('/v1/account') $utopia->delete('/v1/account/sessions/:sessionId') ->desc('Delete Account Session') + ->groups(['api', 'account']) ->label('scope', 'account') ->label('webhook', 'account.sessions.delete') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) @@ -994,6 +1010,7 @@ $utopia->delete('/v1/account/sessions/:sessionId') $utopia->delete('/v1/account/sessions') ->desc('Delete All Account Sessions') + ->groups(['api', 'account']) ->label('scope', 'account') ->label('webhook', 'account.sessions.delete') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) @@ -1044,6 +1061,7 @@ $utopia->delete('/v1/account/sessions') $utopia->post('/v1/account/recovery') ->desc('Create Password Recovery') + ->groups(['api', 'account']) ->label('scope', 'public') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) ->label('sdk.namespace', 'account') @@ -1143,6 +1161,7 @@ $utopia->post('/v1/account/recovery') $utopia->put('/v1/account/recovery') ->desc('Complete Password Recovery') + ->groups(['api', 'account']) ->label('scope', 'public') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) ->label('sdk.namespace', 'account') @@ -1213,6 +1232,7 @@ $utopia->put('/v1/account/recovery') $utopia->post('/v1/account/verification') ->desc('Create Email Verification') + ->groups(['api', 'account']) ->label('scope', 'account') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) ->label('sdk.namespace', 'account') @@ -1299,6 +1319,7 @@ $utopia->post('/v1/account/verification') $utopia->put('/v1/account/verification') ->desc('Complete Email Verification') + ->groups(['api', 'account']) ->label('scope', 'public') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) ->label('sdk.namespace', 'account') diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index 289167c6a..a4d9a9d79 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -90,6 +90,7 @@ $avatarCallback = function ($type, $code, $width, $height, $quality) use ($types $utopia->get('/v1/avatars/credit-cards/:code') ->desc('Get Credit Card Icon') + ->groups(['api', 'avatars']) ->param('code', '', function () use ($types) { return new WhiteList(\array_keys($types['credit-cards'])); }, 'Credit Card Code. Possible values: '.\implode(', ', \array_keys($types['credit-cards'])).'.') ->param('width', 100, function () { return new Range(0, 2000); }, 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('height', 100, function () { return new Range(0, 2000); }, 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) @@ -106,6 +107,7 @@ $utopia->get('/v1/avatars/credit-cards/:code') $utopia->get('/v1/avatars/browsers/:code') ->desc('Get Browser Icon') + ->groups(['api', 'avatars']) ->param('code', '', function () use ($types) { return new WhiteList(\array_keys($types['browsers'])); }, 'Browser Code.') ->param('width', 100, function () { return new Range(0, 2000); }, 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('height', 100, function () { return new Range(0, 2000); }, 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) @@ -122,6 +124,7 @@ $utopia->get('/v1/avatars/browsers/:code') $utopia->get('/v1/avatars/flags/:code') ->desc('Get Country Flag') + ->groups(['api', 'avatars']) ->param('code', '', function () use ($types) { return new WhiteList(\array_keys($types['flags'])); }, 'Country Code. ISO Alpha-2 country code format.') ->param('width', 100, function () { return new Range(0, 2000); }, 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('height', 100, function () { return new Range(0, 2000); }, 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) @@ -138,6 +141,7 @@ $utopia->get('/v1/avatars/flags/:code') $utopia->get('/v1/avatars/image') ->desc('Get Image from URL') + ->groups(['api', 'avatars']) ->param('url', '', function () { return new URL(); }, 'Image URL which you want to crop.') ->param('width', 400, function () { return new Range(0, 2000); }, 'Resize preview image width, Pass an integer between 0 to 2000.', true) ->param('height', 400, function () { return new Range(0, 2000); }, 'Resize preview image height, Pass an integer between 0 to 2000.', true) @@ -205,6 +209,7 @@ $utopia->get('/v1/avatars/image') $utopia->get('/v1/avatars/favicon') ->desc('Get Favicon') + ->groups(['api', 'avatars']) ->param('url', '', function () { return new URL(); }, 'Website URL which you want to fetch the favicon from.') ->label('scope', 'avatars.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) @@ -357,6 +362,7 @@ $utopia->get('/v1/avatars/favicon') $utopia->get('/v1/avatars/qr') ->desc('Get QR Code') + ->groups(['api', 'avatars']) ->param('text', '', function () { return new Text(512); }, 'Plain text to be converted to QR code image.') ->param('size', 400, function () { return new Range(0, 1000); }, 'QR code size. Pass an integer between 0 to 1000. Defaults to 400.', true) ->param('margin', 1, function () { return new Range(0, 10); }, 'Margin from edge. Pass an integer between 0 to 10. Defaults to 1.', true) @@ -390,6 +396,7 @@ $utopia->get('/v1/avatars/qr') $utopia->get('/v1/avatars/initials') ->desc('Get User Initials') + ->groups(['api', 'avatars']) ->param('name', '', function () { return new Text(512); }, 'Full Name. When empty, current user name or email will be used.', true) ->param('width', 500, function () { return new Range(0, 2000); }, 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('height', 500, function () { return new Range(0, 2000); }, 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 13646414a..06c707745 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -29,6 +29,7 @@ include_once __DIR__ . '/../shared/api.php'; $utopia->post('/v1/database/collections') ->desc('Create Collection') + ->groups(['api', 'database']) ->label('webhook', 'database.collections.create') ->label('scope', 'collections.write') ->label('sdk.namespace', 'database') @@ -102,6 +103,7 @@ $utopia->post('/v1/database/collections') $utopia->get('/v1/database/collections') ->desc('List Collections') + ->groups(['api', 'database']) ->label('scope', 'collections.read') ->label('sdk.namespace', 'database') ->label('sdk.platform', [APP_PLATFORM_SERVER]) @@ -150,6 +152,7 @@ $utopia->get('/v1/database/collections') $utopia->get('/v1/database/collections/:collectionId') ->desc('Get Collection') + ->groups(['api', 'database']) ->label('scope', 'collections.read') ->label('sdk.namespace', 'database') ->label('sdk.platform', [APP_PLATFORM_SERVER]) @@ -170,6 +173,7 @@ $utopia->get('/v1/database/collections/:collectionId') // $utopia->get('/v1/database/collections/:collectionId/logs') // ->desc('Get Collection Logs') +// ->groups(['api', 'database']) // ->label('scope', 'collections.read') // ->label('sdk.platform', [APP_PLATFORM_SERVER]) // ->label('sdk.namespace', 'database') @@ -234,6 +238,7 @@ $utopia->get('/v1/database/collections/:collectionId') $utopia->put('/v1/database/collections/:collectionId') ->desc('Update Collection') + ->groups(['api', 'database']) ->label('scope', 'collections.write') ->label('webhook', 'database.collections.update') ->label('sdk.namespace', 'database') @@ -306,6 +311,7 @@ $utopia->put('/v1/database/collections/:collectionId') $utopia->delete('/v1/database/collections/:collectionId') ->desc('Delete Collection') + ->groups(['api', 'database']) ->label('scope', 'collections.write') ->label('webhook', 'database.collections.delete') ->label('sdk.namespace', 'database') @@ -343,6 +349,7 @@ $utopia->delete('/v1/database/collections/:collectionId') $utopia->post('/v1/database/collections/:collectionId/documents') ->desc('Create Document') + ->groups(['api', 'database']) ->label('webhook', 'database.documents.create') ->label('scope', 'documents.write') ->label('sdk.namespace', 'database') @@ -462,6 +469,7 @@ $utopia->post('/v1/database/collections/:collectionId/documents') $utopia->get('/v1/database/collections/:collectionId/documents') ->desc('List Documents') + ->groups(['api', 'database']) ->label('scope', 'documents.read') ->label('sdk.namespace', 'database') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) @@ -529,6 +537,7 @@ $utopia->get('/v1/database/collections/:collectionId/documents') $utopia->get('/v1/database/collections/:collectionId/documents/:documentId') ->desc('Get Document') + ->groups(['api', 'database']) ->label('scope', 'documents.read') ->label('sdk.namespace', 'database') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) @@ -574,6 +583,7 @@ $utopia->get('/v1/database/collections/:collectionId/documents/:documentId') $utopia->patch('/v1/database/collections/:collectionId/documents/:documentId') ->desc('Update Document') + ->groups(['api', 'database']) ->label('webhook', 'database.documents.update') ->label('scope', 'documents.write') ->label('sdk.namespace', 'database') @@ -653,6 +663,7 @@ $utopia->patch('/v1/database/collections/:collectionId/documents/:documentId') $utopia->delete('/v1/database/collections/:collectionId/documents/:documentId') ->desc('Delete Document') + ->groups(['api', 'database']) ->label('scope', 'documents.write') ->label('webhook', 'database.documents.delete') ->label('sdk.namespace', 'database') diff --git a/app/controllers/api/graphql.php b/app/controllers/api/graphql.php index ce39d8e79..0eecb23e1 100644 --- a/app/controllers/api/graphql.php +++ b/app/controllers/api/graphql.php @@ -14,6 +14,7 @@ global $utopia; $utopia->post('/v1/graphql') ->desc('GraphQL Endpoint') + ->groups(['api', 'graphql']) ->label('scope', 'public') ->action( function () { diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 0cf4098f1..76727563a 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -9,6 +9,7 @@ use Appwrite\ClamAV\Network; $utopia->get('/v1/health') ->desc('Get HTTP') + ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'health') @@ -22,6 +23,7 @@ $utopia->get('/v1/health') $utopia->get('/v1/health/version') ->desc('Get Version') + ->groups(['api', 'health']) ->label('scope', 'public') ->action( function () use ($response) { @@ -31,6 +33,7 @@ $utopia->get('/v1/health/version') $utopia->get('/v1/health/db') ->desc('Get DB') + ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'health') @@ -46,6 +49,7 @@ $utopia->get('/v1/health/db') $utopia->get('/v1/health/cache') ->desc('Get Cache') + ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'health') @@ -61,6 +65,7 @@ $utopia->get('/v1/health/cache') $utopia->get('/v1/health/time') ->desc('Get Time') + ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'health') @@ -108,6 +113,7 @@ $utopia->get('/v1/health/time') $utopia->get('/v1/health/queue/webhooks') ->desc('Get Webhooks Queue') + ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'health') @@ -121,6 +127,7 @@ $utopia->get('/v1/health/queue/webhooks') $utopia->get('/v1/health/queue/tasks') ->desc('Get Tasks Queue') + ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'health') @@ -134,6 +141,7 @@ $utopia->get('/v1/health/queue/tasks') $utopia->get('/v1/health/queue/logs') ->desc('Get Logs Queue') + ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'health') @@ -147,6 +155,7 @@ $utopia->get('/v1/health/queue/logs') $utopia->get('/v1/health/queue/usage') ->desc('Get Usage Queue') + ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'health') @@ -160,6 +169,7 @@ $utopia->get('/v1/health/queue/usage') $utopia->get('/v1/health/queue/certificates') ->desc('Get Certificate Queue') + ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'health') @@ -173,6 +183,7 @@ $utopia->get('/v1/health/queue/certificates') $utopia->get('/v1/health/queue/functions') ->desc('Get Functions Queue') + ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'health') @@ -186,6 +197,7 @@ $utopia->get('/v1/health/queue/functions') $utopia->get('/v1/health/storage/local') ->desc('Get Local Storage') + ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'health') @@ -216,6 +228,7 @@ $utopia->get('/v1/health/storage/local') $utopia->get('/v1/health/anti-virus') ->desc('Get Anti virus') + ->groups(['api', 'health']) ->label('scope', 'health.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'health') @@ -238,6 +251,7 @@ $utopia->get('/v1/health/anti-virus') $utopia->get('/v1/health/stats') // Currently only used internally ->desc('Get System Stats') + ->groups(['api', 'health']) ->label('scope', 'god') // ->label('sdk.platform', [APP_PLATFORM_SERVER]) // ->label('sdk.namespace', 'health') diff --git a/app/controllers/api/locale.php b/app/controllers/api/locale.php index 30a1211e9..caf9de0f4 100644 --- a/app/controllers/api/locale.php +++ b/app/controllers/api/locale.php @@ -10,6 +10,7 @@ include_once __DIR__ . '/../shared/api.php'; $utopia->get('/v1/locale') ->desc('Get User Locale') + ->groups(['api', 'locale']) ->label('scope', 'locale.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'locale') @@ -68,6 +69,7 @@ $utopia->get('/v1/locale') $utopia->get('/v1/locale/countries') ->desc('List Countries') + ->groups(['api', 'locale']) ->label('scope', 'locale.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'locale') @@ -85,6 +87,7 @@ $utopia->get('/v1/locale/countries') $utopia->get('/v1/locale/countries/eu') ->desc('List EU Countries') + ->groups(['api', 'locale']) ->label('scope', 'locale.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'locale') @@ -110,6 +113,7 @@ $utopia->get('/v1/locale/countries/eu') $utopia->get('/v1/locale/countries/phones') ->desc('List Countries Phone Codes') + ->groups(['api', 'locale']) ->label('scope', 'locale.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'locale') @@ -135,6 +139,7 @@ $utopia->get('/v1/locale/countries/phones') $utopia->get('/v1/locale/continents') ->desc('List Continents') + ->groups(['api', 'locale']) ->label('scope', 'locale.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'locale') @@ -153,6 +158,7 @@ $utopia->get('/v1/locale/continents') $utopia->get('/v1/locale/currencies') ->desc('List Currencies') + ->groups(['api', 'locale']) ->label('scope', 'locale.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'locale') @@ -169,6 +175,7 @@ $utopia->get('/v1/locale/currencies') $utopia->get('/v1/locale/languages') ->desc('List Languages') + ->groups(['api', 'locale']) ->label('scope', 'locale.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'locale') diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index f95f89a95..d2633985a 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -27,6 +27,7 @@ $scopes = include __DIR__.'/../../../app/config/scopes.php'; $utopia->post('/v1/projects') ->desc('Create Project') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'create') @@ -89,6 +90,7 @@ $utopia->post('/v1/projects') $utopia->get('/v1/projects') ->desc('List Projects') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'list') @@ -122,6 +124,7 @@ $utopia->get('/v1/projects') $utopia->get('/v1/projects/:projectId') ->desc('Get Project') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'get') @@ -149,6 +152,7 @@ $utopia->get('/v1/projects/:projectId') $utopia->get('/v1/projects/:projectId/usage') ->desc('Get Project') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'getUsage') @@ -310,6 +314,7 @@ $utopia->get('/v1/projects/:projectId/usage') $utopia->patch('/v1/projects/:projectId') ->desc('Update Project') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'update') @@ -355,6 +360,7 @@ $utopia->patch('/v1/projects/:projectId') $utopia->patch('/v1/projects/:projectId/oauth2') ->desc('Update Project OAuth2') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'updateOAuth2') @@ -396,6 +402,7 @@ $utopia->patch('/v1/projects/:projectId/oauth2') $utopia->delete('/v1/projects/:projectId') ->desc('Delete Project') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'delete') @@ -441,6 +448,7 @@ $utopia->delete('/v1/projects/:projectId') $utopia->post('/v1/projects/:projectId/webhooks') ->desc('Create Webhook') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'createWebhook') @@ -505,6 +513,7 @@ $utopia->post('/v1/projects/:projectId/webhooks') $utopia->get('/v1/projects/:projectId/webhooks') ->desc('List Webhooks') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'listWebhooks') @@ -537,6 +546,7 @@ $utopia->get('/v1/projects/:projectId/webhooks') $utopia->get('/v1/projects/:projectId/webhooks/:webhookId') ->desc('Get Webhook') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'getWebhook') @@ -570,6 +580,7 @@ $utopia->get('/v1/projects/:projectId/webhooks/:webhookId') $utopia->put('/v1/projects/:projectId/webhooks/:webhookId') ->desc('Update Webhook') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'updateWebhook') @@ -625,6 +636,7 @@ $utopia->put('/v1/projects/:projectId/webhooks/:webhookId') $utopia->delete('/v1/projects/:projectId/webhooks/:webhookId') ->desc('Delete Webhook') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'deleteWebhook') @@ -656,6 +668,7 @@ $utopia->delete('/v1/projects/:projectId/webhooks/:webhookId') $utopia->post('/v1/projects/:projectId/keys') ->desc('Create Key') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'createKey') @@ -702,6 +715,7 @@ $utopia->post('/v1/projects/:projectId/keys') $utopia->get('/v1/projects/:projectId/keys') ->desc('List Keys') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'listKeys') @@ -720,6 +734,7 @@ $utopia->get('/v1/projects/:projectId/keys') $utopia->get('/v1/projects/:projectId/keys/:keyId') ->desc('Get Key') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'getKey') @@ -745,6 +760,7 @@ $utopia->get('/v1/projects/:projectId/keys/:keyId') $utopia->put('/v1/projects/:projectId/keys/:keyId') ->desc('Update Key') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'updateKey') @@ -781,6 +797,7 @@ $utopia->put('/v1/projects/:projectId/keys/:keyId') $utopia->delete('/v1/projects/:projectId/keys/:keyId') ->desc('Delete Key') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'deleteKey') @@ -812,6 +829,7 @@ $utopia->delete('/v1/projects/:projectId/keys/:keyId') $utopia->post('/v1/projects/:projectId/tasks') ->desc('Create Task') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'createTask') @@ -894,6 +912,7 @@ $utopia->post('/v1/projects/:projectId/tasks') $utopia->get('/v1/projects/:projectId/tasks') ->desc('List Tasks') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'listTasks') @@ -926,6 +945,7 @@ $utopia->get('/v1/projects/:projectId/tasks') $utopia->get('/v1/projects/:projectId/tasks/:taskId') ->desc('Get Task') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'getTask') @@ -958,6 +978,7 @@ $utopia->get('/v1/projects/:projectId/tasks/:taskId') $utopia->put('/v1/projects/:projectId/tasks/:taskId') ->desc('Update Task') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'updateTask') @@ -1028,6 +1049,7 @@ $utopia->put('/v1/projects/:projectId/tasks/:taskId') $utopia->delete('/v1/projects/:projectId/tasks/:taskId') ->desc('Delete Task') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'deleteTask') @@ -1059,6 +1081,7 @@ $utopia->delete('/v1/projects/:projectId/tasks/:taskId') $utopia->post('/v1/projects/:projectId/platforms') ->desc('Create Platform') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'createPlatform') @@ -1112,6 +1135,7 @@ $utopia->post('/v1/projects/:projectId/platforms') $utopia->get('/v1/projects/:projectId/platforms') ->desc('List Platforms') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'listPlatforms') @@ -1132,6 +1156,7 @@ $utopia->get('/v1/projects/:projectId/platforms') $utopia->get('/v1/projects/:projectId/platforms/:platformId') ->desc('Get Platform') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'getPlatform') @@ -1157,6 +1182,7 @@ $utopia->get('/v1/projects/:projectId/platforms/:platformId') $utopia->put('/v1/projects/:projectId/platforms/:platformId') ->desc('Update Platform') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'updatePlatform') @@ -1198,6 +1224,7 @@ $utopia->put('/v1/projects/:projectId/platforms/:platformId') $utopia->delete('/v1/projects/:projectId/platforms/:platformId') ->desc('Delete Platform') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'deletePlatform') @@ -1229,6 +1256,7 @@ $utopia->delete('/v1/projects/:projectId/platforms/:platformId') $utopia->post('/v1/projects/:projectId/domains') ->desc('Create Domain') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'createDomain') @@ -1291,6 +1319,7 @@ $utopia->post('/v1/projects/:projectId/domains') $utopia->get('/v1/projects/:projectId/domains') ->desc('List Domains') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'listDomains') @@ -1311,6 +1340,7 @@ $utopia->get('/v1/projects/:projectId/domains') $utopia->get('/v1/projects/:projectId/domains/:domainId') ->desc('Get Domain') + ->groups(['api', 'projects']) ->label('scope', 'projects.read') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'getDomain') @@ -1336,6 +1366,7 @@ $utopia->get('/v1/projects/:projectId/domains/:domainId') $utopia->patch('/v1/projects/:projectId/domains/:domainId/verification') ->desc('Update Domain Verification Status') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'updateDomainVerification') @@ -1392,6 +1423,7 @@ $utopia->patch('/v1/projects/:projectId/domains/:domainId/verification') $utopia->delete('/v1/projects/:projectId/domains/:domainId') ->desc('Delete Domain') + ->groups(['api', 'projects']) ->label('scope', 'projects.write') ->label('sdk.namespace', 'projects') ->label('sdk.method', 'deleteDomain') diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index d5a4ec2c2..b02461626 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -135,6 +135,7 @@ $mimes = [ $utopia->post('/v1/storage/files') ->desc('Create File') + ->groups(['api', 'storage']) ->label('scope', 'files.write') ->label('webhook', 'storage.files.create') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) @@ -271,6 +272,7 @@ $utopia->post('/v1/storage/files') $utopia->get('/v1/storage/files') ->desc('List Files') + ->groups(['api', 'storage']) ->label('scope', 'files.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'storage') @@ -304,6 +306,7 @@ $utopia->get('/v1/storage/files') $utopia->get('/v1/storage/files/:fileId') ->desc('Get File') + ->groups(['api', 'storage']) ->label('scope', 'files.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'storage') @@ -324,6 +327,7 @@ $utopia->get('/v1/storage/files/:fileId') $utopia->get('/v1/storage/files/:fileId/preview') ->desc('Get File Preview') + ->groups(['api', 'storage']) ->label('scope', 'files.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'storage') @@ -337,8 +341,6 @@ $utopia->get('/v1/storage/files/:fileId/preview') ->param('quality', 100, function () { return new Range(0, 100); }, 'Preview image quality. Pass an integer between 0 to 100. Defaults to 100.', true) ->param('background', '', function () { return new HexColor(); }, 'Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.', true) ->param('output', null, function () use ($outputs) { return new WhiteList(\array_merge(\array_keys($outputs), [null])); }, 'Output format type (jpeg, jpg, png, gif and webp).', true) - //->param('storage', 'local', function () {return new WhiteList(array('local'));}, 'Selected storage device. defaults to local') - //->param('token', '', function () {return new Text(128);}, 'Preview token', true) ->action( function ($fileId, $width, $height, $quality, $background, $output) use ($request, $response, $projectDB, $project, $inputs, $outputs, $fileLogos) { $storage = 'local'; @@ -448,6 +450,7 @@ $utopia->get('/v1/storage/files/:fileId/preview') $utopia->get('/v1/storage/files/:fileId/download') ->desc('Get File for Download') + ->groups(['api', 'storage']) ->label('scope', 'files.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'storage') @@ -501,6 +504,7 @@ $utopia->get('/v1/storage/files/:fileId/download') $utopia->get('/v1/storage/files/:fileId/view') ->desc('Get File for View') + ->groups(['api', 'storage']) ->label('scope', 'files.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'storage') @@ -571,6 +575,7 @@ $utopia->get('/v1/storage/files/:fileId/view') $utopia->put('/v1/storage/files/:fileId') ->desc('Update File') + ->groups(['api', 'storage']) ->label('scope', 'files.write') ->label('webhook', 'storage.files.update') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) @@ -616,6 +621,7 @@ $utopia->put('/v1/storage/files/:fileId') $utopia->delete('/v1/storage/files/:fileId') ->desc('Delete File') + ->groups(['api', 'storage']) ->label('scope', 'files.write') ->label('webhook', 'storage.files.delete') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) @@ -658,6 +664,7 @@ $utopia->delete('/v1/storage/files/:fileId') // $utopia->get('/v1/storage/files/:fileId/scan') // ->desc('Scan Storage') +// ->groups(['api', 'storage']) // ->label('scope', 'god') // ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) // ->label('sdk.namespace', 'storage') diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 8aad25bc8..9905508c3 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -24,6 +24,7 @@ include_once __DIR__ . '/../shared/api.php'; $utopia->post('/v1/teams') ->desc('Create Team') + ->groups(['api', 'teams']) ->label('scope', 'teams.write') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'teams') @@ -87,6 +88,7 @@ $utopia->post('/v1/teams') $utopia->get('/v1/teams') ->desc('List Teams') + ->groups(['api', 'teams']) ->label('scope', 'teams.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'teams') @@ -116,6 +118,7 @@ $utopia->get('/v1/teams') $utopia->get('/v1/teams/:teamId') ->desc('Get Team') + ->groups(['api', 'teams']) ->label('scope', 'teams.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'teams') @@ -136,6 +139,7 @@ $utopia->get('/v1/teams/:teamId') $utopia->put('/v1/teams/:teamId') ->desc('Update Team') + ->groups(['api', 'teams']) ->label('scope', 'teams.write') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'teams') @@ -165,6 +169,7 @@ $utopia->put('/v1/teams/:teamId') $utopia->delete('/v1/teams/:teamId') ->desc('Delete Team') + ->groups(['api', 'teams']) ->label('scope', 'teams.write') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'teams') @@ -204,6 +209,7 @@ $utopia->delete('/v1/teams/:teamId') $utopia->post('/v1/teams/:teamId/memberships') ->desc('Create Team Membership') + ->groups(['api', 'teams']) ->label('scope', 'teams.write') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'teams') @@ -380,6 +386,7 @@ $utopia->post('/v1/teams/:teamId/memberships') $utopia->get('/v1/teams/:teamId/memberships') ->desc('Get Team Memberships') + ->groups(['api', 'teams']) ->label('scope', 'teams.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'teams') @@ -437,6 +444,7 @@ $utopia->get('/v1/teams/:teamId/memberships') $utopia->patch('/v1/teams/:teamId/memberships/:inviteId/status') ->desc('Update Team Membership Status') + ->groups(['api', 'teams']) ->label('scope', 'public') ->label('sdk.platform', [APP_PLATFORM_CLIENT]) ->label('sdk.namespace', 'teams') @@ -569,6 +577,7 @@ $utopia->patch('/v1/teams/:teamId/memberships/:inviteId/status') $utopia->delete('/v1/teams/:teamId/memberships/:inviteId') ->desc('Delete Team Membership') + ->groups(['api', 'teams']) ->label('scope', 'teams.write') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'teams') diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index d032cef94..e29e40ade 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -25,6 +25,7 @@ include_once __DIR__ . '/../shared/api.php'; $utopia->post('/v1/users') ->desc('Create User') + ->groups(['api', 'users']) ->label('scope', 'users.write') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'users') @@ -94,6 +95,7 @@ $utopia->post('/v1/users') $utopia->get('/v1/users') ->desc('List Users') + ->groups(['api', 'users']) ->label('scope', 'users.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'users') @@ -148,6 +150,7 @@ $utopia->get('/v1/users') $utopia->get('/v1/users/:userId') ->desc('Get User') + ->groups(['api', 'users']) ->label('scope', 'users.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'users') @@ -189,6 +192,7 @@ $utopia->get('/v1/users/:userId') $utopia->get('/v1/users/:userId/prefs') ->desc('Get User Preferences') + ->groups(['api', 'users']) ->label('scope', 'users.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'users') @@ -218,6 +222,7 @@ $utopia->get('/v1/users/:userId/prefs') $utopia->get('/v1/users/:userId/sessions') ->desc('Get User Sessions') + ->groups(['api', 'users']) ->label('scope', 'users.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'users') @@ -281,6 +286,7 @@ $utopia->get('/v1/users/:userId/sessions') $utopia->get('/v1/users/:userId/logs') ->desc('Get User Logs') + ->groups(['api', 'users']) ->label('scope', 'users.read') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'users') @@ -361,6 +367,7 @@ $utopia->get('/v1/users/:userId/logs') $utopia->patch('/v1/users/:userId/status') ->desc('Update User Status') + ->groups(['api', 'users']) ->label('scope', 'users.write') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'users') @@ -409,6 +416,7 @@ $utopia->patch('/v1/users/:userId/status') $utopia->patch('/v1/users/:userId/prefs') ->desc('Update User Preferences') + ->groups(['api', 'users']) ->label('scope', 'users.write') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'users') @@ -451,6 +459,7 @@ $utopia->patch('/v1/users/:userId/prefs') $utopia->delete('/v1/users/:userId/sessions/:sessionId') ->desc('Delete User Session') + ->groups(['api', 'users']) ->label('scope', 'users.write') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'users') @@ -483,6 +492,7 @@ $utopia->delete('/v1/users/:userId/sessions/:sessionId') $utopia->delete('/v1/users/:userId/sessions') ->desc('Delete User Sessions') + ->groups(['api', 'users']) ->label('scope', 'users.write') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'users') diff --git a/app/controllers/mock.php b/app/controllers/mock.php index d0848d286..097501fbb 100644 --- a/app/controllers/mock.php +++ b/app/controllers/mock.php @@ -352,4 +352,4 @@ $utopia->shutdown(function() use ($response, $request, &$result, $utopia) { } $response->json(['result' => $route->getMethod() . ':' . $route->getURL() . ':passed']); -}); \ No newline at end of file +}, 'mock'); \ No newline at end of file diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index d74f6939f..e911c2c55 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -46,4 +46,4 @@ $utopia->init(function () use ($utopia, $request, $response, $register, $user, $ if ($abuse->check() && $request->getServer('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled') { throw new Exception('Too many requests', 429); } -}); \ No newline at end of file +}, 'api'); \ No newline at end of file diff --git a/app/controllers/shared/web.php b/app/controllers/shared/web.php index 15d904559..a2f85bcb0 100644 --- a/app/controllers/shared/web.php +++ b/app/controllers/shared/web.php @@ -42,4 +42,4 @@ $utopia->init(function () use ($utopia, $response, $request, $layout) { ->setParam('isDev', $isDev) ->setParam('class', $scope) ; -}); +}, 'web'); diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php index ead5017e6..543794609 100644 --- a/app/controllers/web/console.php +++ b/app/controllers/web/console.php @@ -17,7 +17,7 @@ $utopia->init(function () use ($layout) { ->setParam('description', 'Appwrite Console allows you to easily manage, monitor, and control your entire backend API and tools.') ->setParam('analytics', 'UA-26264668-5') ; -}); +}, 'console'); $utopia->shutdown(function () use ($response, $request, $layout) { $header = new View(__DIR__.'/../../views/console/comps/header.phtml'); @@ -34,10 +34,10 @@ $utopia->shutdown(function () use ($response, $request, $layout) { ; $response->send($layout->render()); -}); +}, 'console'); $utopia->get('/error/:code') - ->desc('Error page') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'home') ->param('code', null, new \Utopia\Validator\Numeric(), 'Valid status code number', false) @@ -54,6 +54,7 @@ $utopia->get('/error/:code') }); $utopia->get('/console') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($layout, $request) { @@ -69,6 +70,7 @@ $utopia->get('/console') }); $utopia->get('/console/account') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($layout) { @@ -86,7 +88,7 @@ $utopia->get('/console/account') }); $utopia->get('/console/notifications') - ->desc('Platform console notifications') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($layout) { @@ -98,7 +100,7 @@ $utopia->get('/console/notifications') }); $utopia->get('/console/home') - ->desc('Platform console project home') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($layout) { @@ -110,7 +112,7 @@ $utopia->get('/console/home') }); $utopia->get('/console/settings') - ->desc('Platform console project settings') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($request, $layout) { @@ -129,7 +131,7 @@ $utopia->get('/console/settings') }); $utopia->get('/console/webhooks') - ->desc('Platform console project webhooks') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($layout) { @@ -145,7 +147,7 @@ $utopia->get('/console/webhooks') }); $utopia->get('/console/keys') - ->desc('Platform console project keys') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($layout) { @@ -160,7 +162,7 @@ $utopia->get('/console/keys') }); $utopia->get('/console/tasks') - ->desc('Platform console project tasks') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($layout) { @@ -172,7 +174,7 @@ $utopia->get('/console/tasks') }); $utopia->get('/console/database') - ->desc('Platform console project settings') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($layout) { @@ -184,7 +186,7 @@ $utopia->get('/console/database') }); $utopia->get('/console/database/collection') - ->desc('Platform console project database collection') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->param('id', '', function () { return new UID(); }, 'Collection unique ID.') @@ -216,7 +218,7 @@ $utopia->get('/console/database/collection') }); $utopia->get('/console/database/document') - ->desc('Platform console project database document') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->param('collection', '', function () { return new UID(); }, 'Collection unique ID.') @@ -246,7 +248,7 @@ $utopia->get('/console/database/document') }); $utopia->get('/console/storage') - ->desc('Platform console project settings') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($request, $layout) { @@ -264,7 +266,7 @@ $utopia->get('/console/storage') }); $utopia->get('/console/users') - ->desc('Platform console project settings') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($layout) { @@ -278,7 +280,7 @@ $utopia->get('/console/users') }); $utopia->get('/console/users/user') - ->desc('Platform console project user') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($layout) { @@ -290,7 +292,7 @@ $utopia->get('/console/users/user') }); $utopia->get('/console/users/teams/team') - ->desc('Platform console project team') + ->groups(['web', 'console']) ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($layout) { diff --git a/app/controllers/web/home.php b/app/controllers/web/home.php index 11a7e43b8..f164c832d 100644 --- a/app/controllers/web/home.php +++ b/app/controllers/web/home.php @@ -25,13 +25,14 @@ $utopia->init(function () use ($layout) { ->setParam('header', [$header]) ->setParam('footer', [$footer]) ; -}); +}, 'home'); $utopia->shutdown(function () use ($response, $layout) { $response->send($layout->render()); -}); +}, 'home'); $utopia->get('/') + ->groups(['web', 'home']) ->label('permission', 'public') ->label('scope', 'home') ->action( @@ -41,7 +42,7 @@ $utopia->get('/') ); $utopia->get('/auth/signin') - ->desc('Login page') + ->groups(['web', 'home']) ->label('permission', 'public') ->label('scope', 'home') ->action(function () use ($layout) { @@ -53,7 +54,7 @@ $utopia->get('/auth/signin') }); $utopia->get('/auth/signup') - ->desc('Registration page') + ->groups(['web', 'home']) ->label('permission', 'public') ->label('scope', 'home') ->action(function () use ($layout) { @@ -65,7 +66,7 @@ $utopia->get('/auth/signup') }); $utopia->get('/auth/recovery') - ->desc('Password recovery page') + ->groups(['web', 'home']) ->label('permission', 'public') ->label('scope', 'home') ->action(function () use ($request, $layout) { @@ -77,7 +78,7 @@ $utopia->get('/auth/recovery') }); $utopia->get('/auth/confirm') - ->desc('Account confirmation page') + ->groups(['web', 'home']) ->label('permission', 'public') ->label('scope', 'home') ->action(function () use ($layout) { @@ -89,7 +90,7 @@ $utopia->get('/auth/confirm') }); $utopia->get('/auth/join') - ->desc('Account team join page') + ->groups(['web', 'home']) ->label('permission', 'public') ->label('scope', 'home') ->action(function () use ($layout) { @@ -101,7 +102,7 @@ $utopia->get('/auth/join') }); $utopia->get('/auth/recovery/reset') - ->desc('Password recovery page') + ->groups(['web', 'home']) ->label('permission', 'public') ->label('scope', 'home') ->action(function () use ($layout) { @@ -114,7 +115,7 @@ $utopia->get('/auth/recovery/reset') $utopia->get('/auth/oauth2/success') - ->desc('Registration page') + ->groups(['web', 'home']) ->label('permission', 'public') ->label('scope', 'home') ->action(function () use ($layout) { @@ -129,7 +130,7 @@ $utopia->get('/auth/oauth2/success') }); $utopia->get('/auth/oauth2/failure') - ->desc('Registration page') + ->groups(['web', 'home']) ->label('permission', 'public') ->label('scope', 'home') ->action(function () use ($layout) { @@ -144,7 +145,7 @@ $utopia->get('/auth/oauth2/failure') }); $utopia->get('/error/:code') - ->desc('Error page') + ->groups(['web', 'home']) ->label('permission', 'public') ->label('scope', 'home') ->param('code', null, new \Utopia\Validator\Numeric(), 'Valid status code number', false) @@ -161,6 +162,7 @@ $utopia->get('/error/:code') }); $utopia->get('/open-api-2.json') + ->groups(['web', 'home']) ->label('scope', 'public') ->label('docs', false) ->param('platform', APP_PLATFORM_CLIENT, function () {return new WhiteList([APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER, APP_PLATFORM_CONSOLE]);}, 'Choose target platform.', true) diff --git a/composer.json b/composer.json index 8af76121c..78b0fd76c 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "appwrite/php-clamav": "1.0.*", - "utopia-php/framework": "0.3.5", + "utopia-php/framework": "0.4.0", "utopia-php/abuse": "0.2.*", "utopia-php/audit": "0.3.*", "utopia-php/cache": "0.2.*", diff --git a/composer.lock b/composer.lock index 459a9bd32..595045b9b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9deec50e5a99197511b5efbcaa9593bd", + "content-hash": "7f6cbe77fe2e0f8bdff33c37a4d9ca11", "packages": [ { "name": "appwrite/php-clamav", @@ -459,24 +459,24 @@ "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "89b1a76b7fda5853401297dc4b2a093cba1fda23" + "reference": "bbf3b200bc83c1e9298580a9f99b9be248543467" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/89b1a76b7fda5853401297dc4b2a093cba1fda23", - "reference": "89b1a76b7fda5853401297dc4b2a093cba1fda23", + "url": "https://api.github.com/repos/guzzle/promises/zipball/bbf3b200bc83c1e9298580a9f99b9be248543467", + "reference": "bbf3b200bc83c1e9298580a9f99b9be248543467", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^5.7.27 || ^7.5" + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^7.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -502,7 +502,7 @@ "keywords": [ "promise" ], - "time": "2020-02-15T23:33:03+00:00" + "time": "2020-06-21T23:10:57+00:00" }, { "name": "guzzlehttp/psr7", @@ -1546,16 +1546,16 @@ }, { "name": "utopia-php/domains", - "version": "0.2.0", + "version": "0.2.1", "source": { "type": "git", "url": "https://github.com/utopia-php/domains.git", - "reference": "1665e1d9932afa3be63b5c1e0dcfe01fe77d8e73" + "reference": "98e85296867a59c9d712d6ed768a5c5b2b297b43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/domains/zipball/1665e1d9932afa3be63b5c1e0dcfe01fe77d8e73", - "reference": "1665e1d9932afa3be63b5c1e0dcfe01fe77d8e73", + "url": "https://api.github.com/repos/utopia-php/domains/zipball/98e85296867a59c9d712d6ed768a5c5b2b297b43", + "reference": "98e85296867a59c9d712d6ed768a5c5b2b297b43", "shasum": "" }, "require": { @@ -1592,20 +1592,20 @@ "upf", "utopia" ], - "time": "2020-02-23T07:40:02+00:00" + "time": "2020-06-20T11:47:04+00:00" }, { "name": "utopia-php/framework", - "version": "0.3.5", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/utopia-php/framework.git", - "reference": "ca2ebe37936983d786f57bae8ee6e006299f4942" + "reference": "30aeb2aeecf8ea2ab83242efad0f5f9fab8d4be5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/framework/zipball/ca2ebe37936983d786f57bae8ee6e006299f4942", - "reference": "ca2ebe37936983d786f57bae8ee6e006299f4942", + "url": "https://api.github.com/repos/utopia-php/framework/zipball/30aeb2aeecf8ea2ab83242efad0f5f9fab8d4be5", + "reference": "30aeb2aeecf8ea2ab83242efad0f5f9fab8d4be5", "shasum": "" }, "require": { @@ -1636,7 +1636,7 @@ "php", "upf" ], - "time": "2020-06-20T11:33:46+00:00" + "time": "2020-06-25T18:21:48+00:00" }, { "name": "utopia-php/locale", @@ -3307,12 +3307,12 @@ "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "3beabd64bdc91558b41f140cc4b14925f0416cb2" + "reference": "f32950c872a995a93807909bab69387f47afaa25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/3beabd64bdc91558b41f140cc4b14925f0416cb2", - "reference": "3beabd64bdc91558b41f140cc4b14925f0416cb2", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/f32950c872a995a93807909bab69387f47afaa25", + "reference": "f32950c872a995a93807909bab69387f47afaa25", "shasum": "" }, "require": { @@ -3364,7 +3364,7 @@ "keywords": [ "templating" ], - "time": "2020-06-08T10:41:25+00:00" + "time": "2020-06-22T15:25:21+00:00" }, { "name": "webmozart/assert",