diff --git a/.env b/.env index 4cc3d2ea9..9f6050fe5 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ _APP_ENV=production _APP_ENV=development _APP_LOCALE=en -_APP_CONSOLE_WHITELIST_GOD=disabled +_APP_CONSOLE_WHITELIST_ROOT=disabled _APP_CONSOLE_WHITELIST_EMAILS= _APP_CONSOLE_WHITELIST_IPS= _APP_SYSTEM_EMAIL_NAME=Appwrite diff --git a/CHANGES.md b/CHANGES.md index 89f460919..f4a2e34d5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,7 +12,7 @@ - Added option to disable anonymous login (need to merge and apply changed) (#947) - Added option to disable JWT auth (#947) - Added option to disable team invites (#947) -- Option to limit number of users (good for app launches + god account PR) (#947) +- Option to limit number of users (good for app launches + root account PR) (#947) - Added 2 new endpoints to the projects API to allow new settings - Enabled 501 errors (Not Implemented) from the error handler - Added Python 3.9 as a new Cloud Functions runtime (#1044) diff --git a/Dockerfile b/Dockerfile index ff9b71b9e..8c59bb726 100755 --- a/Dockerfile +++ b/Dockerfile @@ -88,7 +88,7 @@ ENV _APP_SERVER=swoole \ _APP_DOMAIN_TARGET=localhost \ _APP_HOME=https://appwrite.io \ _APP_EDITION=community \ - _APP_CONSOLE_WHITELIST_GOD=enabled \ + _APP_CONSOLE_WHITELIST_ROOT=enabled \ _APP_CONSOLE_WHITELIST_EMAILS= \ _APP_CONSOLE_WHITELIST_IPS= \ _APP_SYSTEM_EMAIL_NAME= \ diff --git a/app/config/collections.php b/app/config/collections.php index 15a6e0abe..1cff0031a 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -46,7 +46,7 @@ $collections = [ 'legalTaxId' => '', 'authWhitelistEmails' => (!empty(App::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null))) ? \explode(',', App::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null)) : [], 'authWhitelistIPs' => (!empty(App::getEnv('_APP_CONSOLE_WHITELIST_IPS', null))) ? \explode(',', App::getEnv('_APP_CONSOLE_WHITELIST_IPS', null)) : [], - 'usersAuthLimit' => (App::getEnv('_APP_CONSOLE_WHITELIST_GOD', 'enabled') === 'enabled') ? 1 : 0, // limit signup to 1 user + 'usersAuthLimit' => (App::getEnv('_APP_CONSOLE_WHITELIST_ROOT', 'enabled') === 'enabled') ? 1 : 0, // limit signup to 1 user ], Database::SYSTEM_COLLECTION_COLLECTIONS => [ '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS, diff --git a/app/config/variables.php b/app/config/variables.php index 11bf59af2..57a913127 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -64,7 +64,7 @@ return [ 'question' => 'Enter a DNS A record hostname to serve as a CNAME for your custom domains.\nYou can use the same value as used for the Appwrite hostname.', ], [ - 'name' => '_APP_CONSOLE_WHITELIST_GOD', + 'name' => '_APP_CONSOLE_WHITELIST_ROOT', 'description' => 'This option allows you to disable the creation of new users on the Appwrite console. When enabled only 1 user will be able to use the registration form. New users can be added by invting them to your project. By default this option is enabled.', 'introduction' => '0.8.0', 'default' => 'enabled', diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index f18c31ef0..01a9050e0 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -272,7 +272,7 @@ App::get('/v1/health/anti-virus') App::get('/v1/health/stats') // Currently only used internally ->desc('Get System Stats') ->groups(['api', 'health']) - ->label('scope', 'god') + ->label('scope', 'root') // ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) // ->label('sdk.namespace', 'health') // ->label('sdk.method', 'getStats') diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 994af027d..f0c63ce7b 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -612,7 +612,7 @@ App::delete('/v1/storage/files/:fileId') // App::get('/v1/storage/files/:fileId/scan') // ->desc('Scan Storage') // ->groups(['api', 'storage']) -// ->label('scope', 'god') +// ->label('scope', 'root') // ->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT]) // ->label('sdk.namespace', 'storage') // ->label('sdk.method', 'getFileScan') diff --git a/app/controllers/general.php b/app/controllers/general.php index 1f7d4ebae..ab70f7e77 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -208,7 +208,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo } }, $user->getAttribute('memberships', [])); - // TDOO Check if user is god + // TDOO Check if user is root if (!\in_array($scope, $scopes)) { if (empty($project->getId()) || Database::SYSTEM_COLLECTION_PROJECTS !== $project->getCollection()) { // Check if permission is denied because project is missing diff --git a/app/controllers/web/home.php b/app/controllers/web/home.php index 3ee54d2db..b18211bfb 100644 --- a/app/controllers/web/home.php +++ b/app/controllers/web/home.php @@ -57,9 +57,9 @@ App::get('/') ; if ('console' === $project->getId()) { - $whitlistGod = $project->getAttribute('authWhitelistGod'); + $whitlistRoot = App::getEnv('_APP_CONSOLE_WHITELIST_ROOT', 'enabled'); - if($whitlistGod !== 'disabled') { + if($whitlistRoot !== 'disabled') { $projectDB->getCollection([ // Count users 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_USERS, @@ -88,7 +88,7 @@ App::get('/auth/signin') $page = new View(__DIR__.'/../../views/home/auth/signin.phtml'); $page - ->setParam('god', App::getEnv('_APP_CONSOLE_WHITELIST_GOD', 'enabled')) + ->setParam('root', App::getEnv('_APP_CONSOLE_WHITELIST_ROOT', 'enabled')) ; $layout @@ -106,7 +106,7 @@ App::get('/auth/signup') $page = new View(__DIR__.'/../../views/home/auth/signup.phtml'); $page - ->setParam('god', App::getEnv('_APP_CONSOLE_WHITELIST_GOD', 'enabled')) + ->setParam('root', App::getEnv('_APP_CONSOLE_WHITELIST_ROOT', 'enabled')) ; $layout diff --git a/app/tasks/doctor.php b/app/tasks/doctor.php index 5feb96047..095adfb95 100644 --- a/app/tasks/doctor.php +++ b/app/tasks/doctor.php @@ -61,11 +61,11 @@ $cli Console::log('🟢 Abuse protection is enabled'); } - $authWhitelistGod = App::getEnv('_APP_CONSOLE_WHITELIST_GOD', null); + $authWhitelistRoot = App::getEnv('_APP_CONSOLE_WHITELIST_ROOT', null); $authWhitelistEmails = App::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null); $authWhitelistIPs = App::getEnv('_APP_CONSOLE_WHITELIST_IPS', null); - if(empty($authWhitelistGod) + if(empty($authWhitelistRoot) && empty($authWhitelistEmails) && empty($authWhitelistIPs) ) { diff --git a/app/views/home/auth/signin.phtml b/app/views/home/auth/signin.phtml index d89f7e41d..fc21da1de 100644 --- a/app/views/home/auth/signin.phtml +++ b/app/views/home/auth/signin.phtml @@ -1,5 +1,5 @@ getParam('god') !== 'disabled'); +$root = ($this->getParam('root') !== 'disabled'); ?>
getParam('god') !== 'disabled');
- Forgot password? or don't have an account? Sign up now + Forgot password? or don't have an account? Sign up now
diff --git a/app/views/home/auth/signup.phtml b/app/views/home/auth/signup.phtml index 6b5d01f7e..7e0532199 100644 --- a/app/views/home/auth/signup.phtml +++ b/app/views/home/auth/signup.phtml @@ -1,5 +1,5 @@ getParam('god') !== 'disabled'); +$root = ($this->getParam('root') !== 'disabled'); ?>

@@ -26,8 +26,8 @@ $god = ($this->getParam('god') !== 'disabled'); data-failure-param-alert-text="Registration Failed. Please try again later" data-failure-param-alert-classname="error"> - -

Please create your first god account

+ +

Please create your root account

@@ -51,7 +51,7 @@ $god = ($this->getParam('god') !== 'disabled');

- +
Already have an account?
diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index c082a1af4..fbd89ff2a 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -57,7 +57,7 @@ services: environment: - _APP_ENV - _APP_LOCALE - - _APP_CONSOLE_WHITELIST_GOD + - _APP_CONSOLE_WHITELIST_ROOT - _APP_CONSOLE_WHITELIST_EMAILS - _APP_CONSOLE_WHITELIST_IPS - _APP_SYSTEM_EMAIL_NAME diff --git a/docker-compose.yml b/docker-compose.yml index e53f59c06..20c412837 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -76,7 +76,7 @@ services: environment: - _APP_ENV - _APP_LOCALE - - _APP_CONSOLE_WHITELIST_GOD + - _APP_CONSOLE_WHITELIST_ROOT - _APP_CONSOLE_WHITELIST_EMAILS - _APP_CONSOLE_WHITELIST_IPS - _APP_SYSTEM_EMAIL_NAME