From f77aa39ff793cef94da24d608955edbdacc46d2d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 12 Jan 2020 13:46:39 +0200 Subject: [PATCH] Updated and synced public available scopes --- app/config/roles.php | 3 +++ app/config/scopes.php | 18 ++++++++++-------- app/controllers/api/projects.php | 13 +------------ app/views/console/keys/index.phtml | 14 +------------- tests/e2e/Scopes/ProjectCustom.php | 11 +++++++++++ 5 files changed, 26 insertions(+), 33 deletions(-) diff --git a/app/config/roles.php b/app/config/roles.php index 399ab9737a..9110795419 100644 --- a/app/config/roles.php +++ b/app/config/roles.php @@ -46,6 +46,9 @@ $admins = [ 'tasks.write', 'webhooks.read', 'webhooks.write', + 'locale.read', + 'avatars.read', + 'health.read', ]; return [ diff --git a/app/config/scopes.php b/app/config/scopes.php index ea309401e6..53b71dd78f 100644 --- a/app/config/scopes.php +++ b/app/config/scopes.php @@ -11,12 +11,14 @@ return [ // List of publicly visible scopes 'documents.write', 'files.read', 'files.write', - 'platforms.read', - 'platforms.write', - 'keys.read', - 'keys.write', - 'tasks.read', - 'tasks.write', - 'webhooks.read', - 'webhooks.write', + // 'platforms.read', + // 'platforms.write', + // 'keys.read', + // 'keys.write', + // 'tasks.read', + // 'tasks.write', + // 'webhooks.read', + // 'webhooks.write', + 'locale.read', + 'avatars.read', ];; \ No newline at end of file diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 242264b90b..d10717905c 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -18,18 +18,7 @@ use Cron\CronExpression; include_once __DIR__ . '/../shared/api.php'; -$scopes = [ // TODO sync with console UI list - 'users.read', - 'users.write', - 'teams.read', - 'teams.write', - 'collections.read', - 'collections.write', - 'documents.read', - 'documents.write', - 'files.read', - 'files.write', -]; +$scopes = include __DIR__.'/../../../app/config/scopes.php'; $utopia->get('/v1/projects') ->desc('List Projects') diff --git a/app/views/console/keys/index.phtml b/app/views/console/keys/index.phtml index 45f9b1a5f2..a7845dcfd0 100644 --- a/app/views/console/keys/index.phtml +++ b/app/views/console/keys/index.phtml @@ -1,17 +1,5 @@ getParam('scopes', []); ?>

diff --git a/tests/e2e/Scopes/ProjectCustom.php b/tests/e2e/Scopes/ProjectCustom.php index c8c95cea10..13bf42fbd6 100644 --- a/tests/e2e/Scopes/ProjectCustom.php +++ b/tests/e2e/Scopes/ProjectCustom.php @@ -90,7 +90,18 @@ trait ProjectCustom ], [ 'name' => 'Demo Project Key', 'scopes' => [ + 'users.read', + 'users.write', + 'teams.read', + 'teams.write', + 'collections.read', + 'collections.write', + 'documents.read', + 'documents.write', 'files.read', + 'files.write', + 'locale.read', + 'avatars.read', ], ]);