diff --git a/app/config/auth.php b/app/config/auth.php new file mode 100644 index 000000000..698646fbd --- /dev/null +++ b/app/config/auth.php @@ -0,0 +1,42 @@ + [ + 'name' => 'Email/Password', + 'key' => 'usersAuthEmailPassword', + 'icon' => '/images/users/email-password.png', + 'docs' => 'https://appwrite.io/docs/client/account?sdk=web#accountCreateSession', + 'enabled' => true, + ], + 'anonymous' => [ + 'name' => 'Anonymous', + 'key' => 'usersAuthAnonymous', + 'icon' => '/images/users/anonymous.png', + 'docs' => 'https://appwrite.io/docs/client/account?sdk=web#accountCreateAnonymousSession', + 'enabled' => true, + ], + 'phone' => [ + 'name' => 'Phone', + 'key' => 'usersAuthPhone', + 'icon' => '/images/users/phone.png', + 'docs' => 'https://appwrite.io/docs/client/account?sdk=web#accountCreatePhoneSession', + 'docs' => '', + 'enabled' => false, + ], + 'invites' => [ + 'name' => 'Invites', + 'key' => 'usersAuthInvites', + 'icon' => '/images/users/invites.png', + 'docs' => 'https://appwrite.io/docs/client/teams?sdk=web#teamsCreateMembership', + 'enabled' => true, + ], + 'jwt' => [ + 'name' => 'JWT', + 'key' => 'usersAuthJWT', + 'icon' => '/images/users/jwt.png', + 'docs' => 'https://appwrite.io/docs/client/account?sdk=web#accountCreateJWT', + 'enabled' => true, + ], +]; \ No newline at end of file diff --git a/app/config/collections.php b/app/config/collections.php index 9170b0757..df54365ee 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -5,6 +5,7 @@ use Utopia\Config\Config; use Appwrite\Database\Database; $providers = Config::getParam('providers', []); +$aith = Config::getParam('auth', []); $collections = [ 'console' => [ @@ -679,6 +680,14 @@ $collections = [ 'default' => '', 'required' => false, ], + [ + '$collection' => Database::SYSTEM_COLLECTION_RULES, + 'label' => 'Max users allowed', + 'key' => 'usersAuthLimit', + 'type' => Database::SYSTEM_VAR_TYPE_NUMERIC, + 'default' => 0, + 'required' => false, + ], [ '$collection' => Database::SYSTEM_COLLECTION_RULES, 'label' => 'Webhooks', @@ -1639,4 +1648,15 @@ foreach ($providers as $index => $provider) { ]; } +foreach ($auth as $key => $method) { + $collections[Database::SYSTEM_COLLECTION_PROJECTS]['rules'][] = [ + '$collection' => Database::SYSTEM_COLLECTION_RULES, + 'label' => $method['name'] || '', + 'key' => $key, + 'type' => Database::SYSTEM_VAR_TYPE_BOOLEAN, + 'default' => true, + 'required' => false, + ]; +} + return $collections; \ No newline at end of file diff --git a/app/config/providers.php b/app/config/providers.php index 36082433c..8525a4216 100644 --- a/app/config/providers.php +++ b/app/config/providers.php @@ -6,6 +6,7 @@ return [ // Ordered by ABC. 'developers' => 'https://developer.amazon.com/apps-and-games/services-and-apis', 'icon' => 'icon-amazon', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -15,6 +16,7 @@ return [ // Ordered by ABC. 'developers' => 'https://developer.apple.com/', 'icon' => 'icon-apple', 'enabled' => true, + 'sandbox' => false, 'form' => 'apple.phtml', // Perperation for adding ability to customized OAuth UI forms, currently handled hardcoded. 'beta' => true, 'mock' => false, @@ -24,6 +26,7 @@ return [ // Ordered by ABC. 'developers' => 'https://developer.atlassian.com/bitbucket', 'icon' => 'icon-bitbucket', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -33,6 +36,7 @@ return [ // Ordered by ABC. 'developers' => 'https://dev.bitly.com/v4_documentation.html', 'icon' => 'icon-bitly', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false @@ -42,6 +46,7 @@ return [ // Ordered by ABC. 'developers' => 'https://developer.box.com/reference/', 'icon' => 'icon-box', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false @@ -51,6 +56,7 @@ return [ // Ordered by ABC. 'developers' => 'https://discordapp.com/developers/docs/topics/oauth2', 'icon' => 'icon-discord', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -60,6 +66,7 @@ return [ // Ordered by ABC. 'developers' => 'https://www.dropbox.com/developers/documentation', 'icon' => 'icon-dropbox', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -69,6 +76,7 @@ return [ // Ordered by ABC. 'developers' => 'https://developers.facebook.com/', 'icon' => 'icon-facebook', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -78,6 +86,7 @@ return [ // Ordered by ABC. 'developers' => 'https://developer.github.com/', 'icon' => 'icon-github-circled', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -87,6 +96,7 @@ return [ // Ordered by ABC. 'developers' => 'https://docs.gitlab.com/ee/api/', 'icon' => 'icon-gitlab', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -96,6 +106,7 @@ return [ // Ordered by ABC. 'developers' => 'https://support.google.com/googleapi/answer/6158849', 'icon' => 'icon-google', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -105,6 +116,7 @@ return [ // Ordered by ABC. 'developers' => 'https://developer.linkedin.com/', 'icon' => 'icon-linkedin', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -114,6 +126,7 @@ return [ // Ordered by ABC. 'developers' => 'https://developer.microsoft.com/en-us/', 'icon' => 'icon-windows', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -123,15 +136,17 @@ return [ // Ordered by ABC. 'developers' => 'https://developer.paypal.com/docs/api/overview/', 'icon' => 'icon-paypal', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false ], 'paypalSandbox' => [ - 'name' => 'PayPal (Sandbox)', + 'name' => 'PayPal', 'developers' => 'https://developer.paypal.com/docs/api/overview/', 'icon' => 'icon-paypal', 'enabled' => true, + 'sandbox' => true, 'form' => false, 'beta' => false, 'mock' => false @@ -141,6 +156,7 @@ return [ // Ordered by ABC. 'developers' => 'https://developer.salesforce.com/docs/', 'icon' => 'icon-salesforce', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -150,6 +166,7 @@ return [ // Ordered by ABC. 'developers' => 'https://api.slack.com/', 'icon' => 'icon-slack', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -159,6 +176,7 @@ return [ // Ordered by ABC. 'developers' => 'https://developer.spotify.com/documentation/general/guides/authorization-guide/', 'icon' => 'icon-spotify', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -168,15 +186,17 @@ return [ // Ordered by ABC. 'developers' => 'https://developers.tradeshift.com/docs/api', 'icon' => 'icon-tradeshift', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, ], 'tradeshiftBox' => [ - 'name' => 'Tradeshift Sandbox', + 'name' => 'Tradeshift', 'developers' => 'https://developers.tradeshift.com/docs/api', 'icon' => 'icon-tradeshiftbox', 'enabled' => true, + 'sandbox' => true, 'form' => false, 'beta' => false, 'mock' => false, @@ -186,6 +206,7 @@ return [ // Ordered by ABC. 'developers' => 'https://dev.twitch.tv/docs/authentication', 'icon' => 'icon-twitch', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -195,6 +216,7 @@ return [ // Ordered by ABC. 'developers' => 'https://vk.com/dev', 'icon' => 'icon-vk', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -204,6 +226,7 @@ return [ // Ordered by ABC. 'developers' => 'https://developer.yahoo.com/oauth2/guide/flows_authcode/', 'icon' => 'icon-yahoo', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -213,6 +236,7 @@ return [ // Ordered by ABC. 'developers' => 'https://tech.yandex.com/oauth/', 'icon' => 'icon-yandex', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false, @@ -238,6 +262,7 @@ return [ // Ordered by ABC. 'developers' => 'https://developer.wordpress.com/docs/oauth2/', 'icon' => 'icon-wordpress', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => false @@ -248,6 +273,7 @@ return [ // Ordered by ABC. 'developers' => 'https://appwrite.io', 'icon' => 'icon-appwrite', 'enabled' => true, + 'sandbox' => false, 'form' => false, 'beta' => false, 'mock' => true, diff --git a/app/config/variables.php b/app/config/variables.php index 14b29bc45..84b328834 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -25,7 +25,7 @@ return [ ], [ 'name' => '_APP_OPTIONS_FORCE_HTTPS', - 'description' => 'Allows you to force HTTPS connection to your API. This feature redirects any HTTP call to HTTPS and adds the \'Strict-Transport-Security\' header to all HTTP responses. By default, set to \'disabled\'. To enable, set to \'enabled\'. This feature will work only when your ports are set to default 80 and 443.', + 'description' => 'Allows you to force HTTPS connection to your API. This feature redirects any HTTP call to HTTPS and adds the \'Strict-Transport-Security\' header to all HTTP responses. By default, set to \'enabled\'. To disable, set to \'disabled\'. This feature will work only when your ports are set to default 80 and 443.', 'introduction' => '', 'default' => 'enabled', 'required' => false, diff --git a/app/init.php b/app/init.php index a70ed1b88..f1d7f3e52 100644 --- a/app/init.php +++ b/app/init.php @@ -70,6 +70,7 @@ App::setMode(App::getEnv('_APP_ENV', App::MODE_TYPE_PRODUCTION)); * ENV vars */ Config::load('events', __DIR__.'/config/events.php'); +Config::load('auth', __DIR__.'/config/auth.php'); Config::load('providers', __DIR__.'/config/providers.php'); Config::load('platforms', __DIR__.'/config/platforms.php'); Config::load('collections', __DIR__.'/config/collections.php');