diff --git a/.travis.yml b/.travis.yml index 8a0b1770a3..a6fbe5944e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,4 +30,4 @@ install: script: - docker ps -- docker exec appwrite /bin/bash -c '/usr/share/nginx/html/vendor/bin/phpunit' +- docker exec appwrite test diff --git a/CHANGES.md b/CHANGES.md index b478ebc940..76ed62173a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,18 +11,18 @@ - Added support for Brotli compression (@PedroCisnerosSantana, @Rohitub222) - New UI micro-interactions and CSS fixes (@AnatoleLucet) - UI performance & accessibility improvments (#406) -- Updated ClamAV conntainer to version 1.0.9 - New Doctor CLI to debug the Appwrite server ([#415](https://github.com/appwrite/appwrite/issues/415)) - All emails are now sent asynchronously for improved performance (@TorstenDittmann) - Updated grid for OAuth2 providers list in the console - Upgraded Redis Resque queue library to version 1.3.6 - Added container names to docker-compose.yml (@drandell) -- Upgraded ClamAV container image to version 1.0.9 +- Upgraded ClamAV container image to version 1.0.11 ([#412](https://github.com/appwrite/appwrite/issues/412)) - Optimised function execution by using fully-qualified function calls - New and consistent response format for all API object + new response examples in the docs - Removed user roles attribute from user object (can be fetched from /v1/teams/memberships) ** - Removed type attribute from session object response (used only internally) - ** - might be changed before merging to master +- Added support for boolean 'true' and 'false' in query strings alongside 1 and 0 ## Bug Fixes @@ -38,6 +38,15 @@ - Fixed wrong JSON validation when creating and updating database documnets - Fixed bug where max file size was limited to max of 10MB - Fixed bug preventing the deletion of the project logo +- Fixed Bug when trying to overwrite OAuth cookie in the Flutter SDK +- Fixed OAuth redirect when using the self-hosted instance default success URL ([#454](https://github.com/appwrite/appwrite/issues/454)) +- Fixed bug denying authentication with Github OAuth provider +- New OAuth adapter for Box.com +- New OAuth adapter for PayPal sandbox + +## Breaking Changes +- **Deprecated** `first` and `last` query params for documents list route in the database API +- **Deprecated** Deprectaed Pubjabi Translations ('pn') ## Security diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b722a0b198..4e6d85ab42 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -153,6 +153,12 @@ bash ./build.sh 1.0.0 Before running the command, make sure you have proper write permissions to the Appwrite docker hub team. +**Build for multicore** + +```bash +docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t appwrite/multicore:0.0.0 --push +``` + ## Tests To run tests manually, run phpunit from your command line: diff --git a/app/app.php b/app/app.php index 347ff3c489..5e5d30150c 100644 --- a/app/app.php +++ b/app/app.php @@ -1,6 +1,5 @@ init(function () use ($utopia, $request, $response, &$user, $project, $console, $roles, $webhook, $mail, $audit, $usage, $clients) { +$utopia->init(function () use ($utopia, $request, $response, &$user, $project, $console, $webhook, $mail, $audit, $usage, $clients) { $route = $utopia->match($request); @@ -143,6 +139,7 @@ $utopia->init(function () use ($utopia, $request, $response, &$user, $project, $ } } + $roles = Config::getParam('roles', []); $scope = $route->getLabel('scope', 'none'); // Allowed scope for chosen route $scopes = $roles[$role]['scopes']; // Allowed scopes for user role @@ -428,8 +425,8 @@ $utopia->get('/.well-known/acme-challenge') include_once __DIR__ . '/controllers/shared/api.php'; include_once __DIR__ . '/controllers/shared/web.php'; -foreach($services as $key => $service) { - include_once $services[$key]['controller']; +foreach(Config::getParam('services', []) as $service) { + include_once $service['controller']; } $utopia->run($request, $response); \ No newline at end of file diff --git a/app/config/locales.php b/app/config/locales.php index 45b48cee07..84738367be 100644 --- a/app/config/locales.php +++ b/app/config/locales.php @@ -31,7 +31,6 @@ return [ 'no', // Norwegian 'ph', // Filipino 'pl', // Polish - 'pn', // Punjabi 'pt-br', // Portuguese - Brazil 'pt-pt', // Portuguese - Portugal 'ro', // Romanian diff --git a/app/config/locales/pn.continents.php b/app/config/locales/pn.continents.php deleted file mode 100644 index ccf3057116..0000000000 --- a/app/config/locales/pn.continents.php +++ /dev/null @@ -1,10 +0,0 @@ - 'ਅਫਰੀਕਾ', - 'AN' => 'ਅੰਤਾਰਕਟੀਕਾ', - 'AS' => 'ਏਸੀਆਈ', - 'EU' => 'ਯੂਰੋਪਾ', - 'NA' => 'ਨੂਰਡ-ਅਮੇਰਿਕਾ', - 'OC' => 'ਓਸੀਆਨੀ', - 'SA' => 'ਸੂਡ-ਅਮੇਰਿਕਾ', -]; diff --git a/app/config/locales/pn.countries.php b/app/config/locales/pn.countries.php deleted file mode 100644 index ed16e84333..0000000000 --- a/app/config/locales/pn.countries.php +++ /dev/null @@ -1,197 +0,0 @@ - 'ਅਫਗਾਨਿਸਤਾਨ', - 'AO' => 'ਅੰਗੋਲਾ', - 'AL' => 'ਅਲਬਾਨੀë', - 'AD' => 'ਅੰਡੋਰਾ', - 'AE' => 'Verenigde ਅਰਬਿਅਨ ਅਮੀਰਾਤ', - 'AR' => 'ਅਰਜਨਟੀਨੀë', - 'AM' => 'ਅਰਮੀਨੀë', - 'AG' => 'ਐਂਟੀਗੁਆ ਐਨ ਬਾਰਬੁਡਾ', - 'AU' => 'ਆਸਟਰੇਲੀਆਈ', - 'AT' => 'ਓਓਸਟੇਨਰੀਕ', - 'AZ' => 'ਅਜ਼ਰਬਾਈਜਾਨ', - 'BI' => 'ਬੁਰੂੰਡੀ', - 'BE' => 'ਬੈਲਜੀë', - 'BJ' => 'ਬੇਨਿਨ', - 'BF' => 'ਬੁਰਕੀਨਾ ਫਾਸੋ', - 'BD' => 'ਬੰਗਲਾਦੇਸ਼', - 'BG' => 'ਬੁਲਗਾਰੀ', - 'BH' => 'ਬਹਿਰੀਨ', - 'BS' => 'ਬਾਹਾਮਸ', - 'BA' => 'ਬੋਸਨੀਅ ਇਨ ਹਰਜ਼ੈਗੋਵਿਨਾ', - 'BY' => 'ਬੇਲਾਰੂਸ', - 'BZ' => 'ਬੇਲੀਜ਼', - 'BO' => 'ਬੋਲੀਵੀਆ', - 'BR' => 'ਬ੍ਰਾਸੀਲੀë', - 'BB' => 'ਬਾਰਬਾਡੋਸ', - 'BN' => 'ਬਰੂਨੇਈ', - 'BT' => 'ਭੋਏਤਨ', - 'BW' => 'ਬੋਤਸਵਾਨਾ', - 'CF' => 'ਮੱਧ ਅਫ਼ਰੀਕੀ ਗਣਰਾਜ', - 'CA' => 'ਕਨਡਾ', - 'CH' => 'ਸਵਿਟਜ਼ਰਲੈਂਡ', - 'CL' => 'ਚਿਲੀ', - 'CN' => 'ਸਜੀਨਾ', - 'CI' => 'ਇਵੋੋਰਕਸ', - 'CM' => 'ਕਾਮਰੋਇਨ', - 'CD' => 'ਡੈਮੋਕਰੇਟੀਜ਼ ਰਿਪਬਲਿਕ ਵੈਨ ਡਾਈ ਕੌਂਗੋ', - 'CG' => 'ਰਿਪਬਲਿਕ ਵੈਨ ਡਾਈ ਕੌਂਗੋ', - 'CO' => 'ਕੋਲੰਬੀਆ', - 'KM' => 'ਕੋਮੋਰੋਜ਼', - 'CV' => 'ਕਾਪ ਵਰਡੇ', - 'CR' => 'ਕੋਸਟਾਰੀਕਾ', - 'CU' => 'ਕੁਬਾ', - 'CY' => 'ਸਾਈਪ੍ਰਸ', - 'CZ' => 'ਸਿਜ਼ੈਗੀ ਰੀਪਬਲਿਕ', - 'DE' => 'ਡਿਟਸਲੈਂਡ', - 'DJ' => 'ਜਾਇਬੂਤੀ', - 'DM' => 'ਡੋਮਿਨਿਕਾ', - 'DK' => 'ਡੀਨੇਮਾਰਕ', - 'DO' => 'ਡੋਮੀਨੀਕੇਂਸ ਰਿਪਬਲਿਕ', - 'DZ' => 'ਅਲਜੀਰੀਆ', - 'EC' => 'ਇਕੂਏਟਰ', - 'EG' => 'ਐਗਪੇਟ', - 'ER' => 'ਏਰੀਟਰੀਆ', - 'ES' => 'ਸਪੰਜੇ', - 'EE' => 'ਐਸਟਲੈਂਡ', - 'ET' => 'ਈਥੀਓਪੀਅ', - 'FI' => 'ਫਿਨਲੈਂਡ', - 'FJ' => 'ਫਿਦਜੀ', - 'FR' => 'ਫ੍ਰੈਂਕ੍ਰੀਕ', - 'FM' => 'ਮਿਕਰੋਨੇਸੀ', - 'GA' => 'ਗਾਬੋਅਨ', - 'GB' => 'Verenigde Koninkryk', - 'GE' => 'ਜਾਰਜੀਆ', - 'GH' => 'ਘਾਨਾ', - 'GN' => 'ਗਿੰਨੀ', - 'GM' => 'ਗਾਮੀ', - 'GW' => 'ਗਿੰਨੀ-ਬਿਸਾਉ', - 'GQ' => 'ਏਕਵੇਟਰਿਆਲ-ਗਿੰਨੀ', - 'GR' => 'ਗ੍ਰੀਕਲੈਂਡ', - 'GD' => 'ਗ੍ਰੇਨਾਡਾ', - 'GT' => 'ਗੁਆਟੇਮਾਲਾ', - 'GY' => 'ਗੁਆਨਾ', - 'HN' => 'ਹੌਂਡੂਰਸ', - 'HR' => 'ਕ੍ਰੋਸੀë', - 'HT' => 'ਹੈਤੀ', - 'HU' => 'ਹਾਂਗਰੀ', - 'ID' => 'ਇੰਡੋਨੇਸ਼ੀਆਈ', - 'IN' => 'ਇੰਡੀë', - 'IE' => 'ਆਇਰਲੈਂਡ', - 'IR' => 'ਇਰਾਨ', - 'IQ' => 'ਇਰਕ', - 'IS' => 'Ysland', - 'IL' => 'ਇਜ਼ਰਾਈਲ', - 'IT' => 'ਇਟਾਲੀë', - 'JM' => 'ਜਮਾਏਕਾ', - 'JO' => 'ਜਾਰਡਨ', - 'JP' => 'ਜਪਾਨ', - 'KZ' => 'ਕਜ਼ਾਕਸਤਾਨ', - 'KE' => 'ਕੀਨੀਆ', - 'KG' => 'ਕਿਰਗਿਸਤਾਨ', - 'KH' => 'ਕੰਬੋਡਜਾ', - 'KI' => 'ਕਿਰੀਬਾਤੀ', - 'KN' => 'ਸੇਂਟ ਕਿਟਸ ਐਨ ਨੇਵਿਸ', - 'KR' => 'ਸੂਡ-ਕੋਰੀਆ', - 'KW' => 'ਕੁਵੈਤ', - 'LA' => 'ਲਾਓਸ', - 'LB' => 'ਲਿਬਨਾਨ', - 'LR' => 'ਲਿਬੇਰੀë', - 'LY' => 'ਲੀਬੀë', - 'LC' => 'ਸੇਂਟ ਲੂਸੀਆ', - 'LI' => 'ਲਿਚਟੇਨਸਟਾਈਨ', - 'LK' => 'ਸ਼ਿਰੀਲੰਕਾ', - 'LS' => 'ਲੈਸੋਥੋ', - 'LT' => 'ਲੀਟਾ', - 'LU' => 'ਲਕਸਮਬਰਗ', - 'LV' => 'ਲਾਤਵੀਆ', - 'MA' => 'ਮਾਰੋਕੋ', - 'MC' => 'ਮੋਨੈਕੋ', - 'MD' => 'ਮੋਲਦਾਵੀ', - 'MG' => 'ਮੈਡਾਗਾਸਕਰ', - 'MV' => 'ਮਾਲਦੀਵ', - 'MX' => 'ਮੇਕਸਿਕੋ', - 'MH' => 'ਮਾਰਸ਼ਲ-ਆਈਲੈਂਡ', - 'MK' => 'ਮੈਸੇਡੋਨੀë', - 'ML' => 'ਮਾਲੀ', - 'MT' => 'ਮਾਲਟਾ', - 'MM' => 'ਮਿਆਂਮਾਰ', - 'ME' => 'ਮੌਂਟੇਨੇਗਰੋ', - 'MN' => 'ਮੰਗੋਲੀë', - 'MZ' => 'ਮੋਸਾਮਬੀਕ', - 'MR' => 'ਮੌਰੀਟਨੀë', - 'MU' => 'ਮਾਰੀਸ਼ਸ', - 'MW' => 'ਮਾਲਾਵੀ', - 'MY' => 'ਮਲੇਸੀਆਈ', - 'NA' => 'ਨਾਮੀਬੀ', - 'NE' => 'ਨਾਈਜਰ', - 'NG' => 'ਨਾਈਜੀਰੀë', - 'NI' => 'ਨਿਕਾਰਾਗੁਆ', - 'NL' => 'ਨੀਡਰਲੈਂਡ', - 'NO' => 'ਨੂਰਵੇë', - 'NP' => 'ਨੇਪਾਲ', - 'NR' => 'ਨੌਰੂ', - 'NZ' => 'ਨਿie-ਸੀਲੈਂਡ', - 'OM' => 'ਓਮਾਨ', - 'PK' => 'ਪਾਕਿਸਤਾਨ', - 'PA' => 'ਪਨਾਮਾ', - 'PE' => 'ਪੇਰੂ', - 'PH' => 'ਫਿਲਪੀਨ', - 'PW' => 'ਪਲਾਉ', - 'PG' => 'ਪਾਪੀਆ-ਨੀਯੂ-ਗਿੰਨੀ', - 'PL' => 'ਪੋਲ', - 'KP' => 'ਨੂਰਡ-ਕੋਰੀਆ', - 'PT' => 'ਪੁਰਤਗਾਲ', - 'PY' => 'ਪੈਰਾਗੁਏ', - 'QA' => 'ਕਟਾਰ', - 'RO' => 'ਰੋਮੇਨੀਅ', - 'RU' => 'ਰਸਲੈਂਡ', - 'RW' => 'ਰਵਾਂਡਾ', - 'SA' => 'ਸਾਓਦੀ-ਅਰਾਬੀ', - 'SD' => 'ਸੋਦਾਨ', - 'SN' => 'ਸੇਨੇਗਲ', - 'SG' => 'ਸਿੰਗਾਪੁਰ', - 'SB' => 'ਸਲੋਮੋ-ਆਈਲੈਂਡ', - 'SL' => 'ਸੀਅਰਾ ਲਿਓਨ', - 'SV' => 'ਐਲ ਸਾਲਵਾਡੋਰ', - 'SM' => 'ਸੈਨ ਮਰੀਨੋ', - 'SO' => 'ਸੋਮਾਲੀë', - 'RS' => 'ਸਰਵੀë', - 'SS' => 'ਸੂਇਡ-ਸੋਦਾਨ', - 'ST' => 'ਸਾਓ ਤੋਮੇ ਐਨ ਪ੍ਰਿੰਸੀਪੇ', - 'SR' => 'ਸੂਰੀਨਾਮ', - 'SK' => 'ਸਲੋਕਯੇ', - 'SI' => 'ਹੌਲੀ', - 'SE' => 'ਸਵੈਡੇ', - 'SZ' => 'ਸਵਾਜ਼ੀਲੈਂਡ', - 'SC' => 'ਸੇਸ਼ੇਲ', - 'SY' => 'ਸਿਰੀ', - 'TD' => 'ਚਾਡ', - 'TG' => 'ਹੁਣੇ ਜਾਣਾ', - 'TH' => 'ਥਾਈਲੈਂਡ', - 'TJ' => 'ਤਦਜਿਕਿਸਤਾਨ', - 'TM' => 'ਤੁਰਕਮੇਨਿਸਤਾਨ', - 'TL' => 'ਓਸ-ਤਿਮੋਰ', - 'TO' => 'ਟੋਂਗਾ', - 'TT' => 'ਤ੍ਰਿਨੀਦਾਦ ਅਤੇ ਟੋਬੈਗੋ', - 'TN' => 'ਟਿisਨੀਸੀਅ', - 'TR' => 'ਤੁਰਕੀ', - 'TV' => 'ਤੁਵਾਲੁ', - 'TZ' => 'ਤਨਜ਼ਾਨੀë', - 'UG' => 'ਯੂਗਾਂਡਾ', - 'UA' => 'ਓਕ੍ਰਾੱਨ', - 'UY' => 'ਉਰੂਗਵੇ', - 'US' => 'ਵੇਰੇਨਿਗਡੇ ਸਟੇਟ', - 'UZ' => 'ਓਸਬੀਕਕਿਸਤਾਨ', - 'VA' => 'ਵਾਟਿਕਾਂਸਟੈਡ', - 'VC' => 'ਸਿਨਟ ਵਿਨਸੈਂਟ ਏਨ ਡਾਈ ਗ੍ਰੇਨਾਡਾਈਨਜ਼', - 'VE' => 'ਵੈਨਜ਼ੂਏਲਾ', - 'VN' => 'ਵਿਯਤਨਮ', - 'VU' => 'ਵੈਨੂਆਟੂ', - 'WS' => 'ਸਮੋਆ', - 'YE' => 'ਜੀਮਨ', - 'ZA' => 'ਸੂਡ-ਅਫਰੀਕਾ', - 'ZM' => 'ਜ਼ੈਂਬੀਆ', - 'ZW' => 'ਜ਼ਿੰਬਾਬਵੇ', -]; diff --git a/app/config/locales/pn.php b/app/config/locales/pn.php deleted file mode 100644 index a53f2ef2b1..0000000000 --- a/app/config/locales/pn.php +++ /dev/null @@ -1,17 +0,0 @@ - '"I love Typing&coding in punjabi :)."', // This is the line printed in the homepage and console 'view-source' - 'settings.locale' => 'pn', - 'settings.direction' => 'ltr', - // Service - Users - 'account.emails.team' => '%s ਟੀਮ(Priyanka)', - 'account.emails.verification.title' => 'ਖਾਤਾ ਪੁਸ਼ਟੀਕਰਣ', - 'account.emails.verification.body' => 'app/config/locales/templates/pn.email.auth.confirm.tpl', - 'account.emails.recovery.title' => 'ਪਾਸਵਰਡ ਰੀਸੈੱਟ', - 'account.emails.recovery.body' => 'app/config/locales/templates/pn.email.auth.recovery.tpl', - 'account.emails.invitation.title' => '% S ਟੀਮ% s ਤੇ ਸੱਦਾ', - 'account.emails.invitation.body' => 'app/config/locales/templates/pn.email.auth.invitation.tpl', - 'locale.country.unknown' => 'India', - 'countries' => include 'pn.countries.php', - 'continents' => include 'pn.continents.php', -]; diff --git a/app/config/locales/templates/pn.email.auth.confirm.tpl b/app/config/locales/templates/pn.email.auth.confirm.tpl deleted file mode 100644 index c96d27dee1..0000000000 --- a/app/config/locales/templates/pn.email.auth.confirm.tpl +++ /dev/null @@ -1,15 +0,0 @@ -

- ਹੈਲੋ {{name}}, -

-

- ਆਪਣੇ ਈਮੇਲ ਪਤੇ ਦੀ ਪੁਸ਼ਟੀ ਕਰਨ ਲਈ ਇਸ ਲਿੰਕ ਦਾ ਪਾਲਣ ਕਰੋ: -

-{{cta}} -

- ਜੇ ਤੁਸੀਂ ਇਸ ਪਤੇ ਨੂੰ ਪ੍ਰਮਾਣਿਤ ਕਰਨ ਲਈ ਨਹੀਂ ਕਿਹਾ, ਤਾਂ ਤੁਸੀਂ ਇਸ ਸੁਨੇਹੇ ਨੂੰ ਨਜ਼ਰ ਅੰਦਾਜ਼ ਕਰ ਸਕਦੇ ਹੋ. -

-

- ਧੰਨਵਾਦ, -
- {{project}} ਟੀਮ -

diff --git a/app/config/locales/templates/pn.email.auth.invitation.tpl b/app/config/locales/templates/pn.email.auth.invitation.tpl deleted file mode 100644 index 6280d951a1..0000000000 --- a/app/config/locales/templates/pn.email.auth.invitation.tpl +++ /dev/null @@ -1,18 +0,0 @@ -

- ਸਤ ਸ੍ਰੀ ਅਕਾਲ, -

-

- ਇਹ ਮੇਲ ਤੁਹਾਨੂੰ ਇਸ ਲਈ ਭੇਜਿਆ ਗਿਆ ਸੀ ਕਿਉਂਕਿ {{owner}} ਤੁਹਾਨੂੰ {{team} at ਟੀਮ {{project}} 'ਤੇ ਟੀਮ ਦੇ ਮੈਂਬਰ ਬਣਨ ਲਈ ਸੱਦਾ ਦੇਣਾ ਚਾਹੁੰਦਾ ਸੀ. -

-

- {{team}} ਟੀਮ ਵਿੱਚ ਸ਼ਾਮਲ ਹੋਣ ਲਈ ਇਸ ਲਿੰਕ ਦਾ ਪਾਲਣ ਕਰੋ: -

-{{cta}} -

- ਜੇ ਤੁਸੀਂ ਦਿਲਚਸਪੀ ਨਹੀਂ ਰੱਖਦੇ, ਤਾਂ ਤੁਸੀਂ ਇਸ ਸੰਦੇਸ਼ ਨੂੰ ਨਜ਼ਰ ਅੰਦਾਜ਼ ਕਰ ਸਕਦੇ ਹੋ. -

-

- ਧੰਨਵਾਦ, -
- {{project}} ਟੀਮ -

diff --git a/app/config/locales/templates/pn.email.auth.recovery.tpl b/app/config/locales/templates/pn.email.auth.recovery.tpl deleted file mode 100644 index cdb4fd069d..0000000000 --- a/app/config/locales/templates/pn.email.auth.recovery.tpl +++ /dev/null @@ -1,15 +0,0 @@ -

- ਸਤ ਸ੍ਰੀ ਅਕਾਲ {{name}}, -

-

- ਆਪਣੇ {{project}} ਪਾਸਵਰਡ ਨੂੰ ਰੀਸੈਟ ਕਰਨ ਲਈ ਇਸ ਲਿੰਕ ਦਾ ਪਾਲਣ ਕਰੋ. -

-{{cta}} -

- ਜੇ ਤੁਸੀਂ ਆਪਣਾ ਪਾਸਵਰਡ ਰੀਸੈਟ ਕਰਨ ਲਈ ਨਹੀਂ ਕਿਹਾ, ਤਾਂ ਤੁਸੀਂ ਇਸ ਸੁਨੇਹੇ ਨੂੰ ਨਜ਼ਰ ਅੰਦਾਜ਼ ਕਰ ਸਕਦੇ ਹੋ. -

-

- ਧੰਨਵਾਦ, -
- {{project}} ਟੀਮ -

diff --git a/app/config/providers.php b/app/config/providers.php index 505c2898c4..65e2127b3e 100644 --- a/app/config/providers.php +++ b/app/config/providers.php @@ -2,6 +2,7 @@ return [ // Ordered by ABC. 'amazon' => [ + 'name' => 'Amazon', 'developers' => 'https://developer.amazon.com/apps-and-games/services-and-apis', 'icon' => 'icon-amazon', 'enabled' => true, @@ -10,6 +11,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'apple' => [ + 'name' => 'Apple', 'developers' => 'https://developer.apple.com/', 'icon' => 'icon-apple', 'enabled' => true, @@ -18,6 +20,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'bitbucket' => [ + 'name' => 'BitBucket', 'developers' => 'https://developer.atlassian.com/bitbucket', 'icon' => 'icon-bitbucket', 'enabled' => true, @@ -26,6 +29,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'bitly' => [ + 'name' => 'Bitly', 'developers' => 'https://dev.bitly.com/v4_documentation.html', 'icon' => 'icon-bitly', 'enabled' => true, @@ -33,7 +37,17 @@ return [ // Ordered by ABC. 'beta' => false, 'mock' => false ], + 'box' => [ + 'name' => 'Box', + 'developers' => 'https://developer.box.com/reference/', + 'icon' => 'icon-box', + 'enabled' => true, + 'form' => false, + 'beta' => false, + 'mock' => false + ], 'discord' => [ + 'name' => 'Discord', 'developers' => 'https://discordapp.com/developers/docs/topics/oauth2', 'icon' => 'icon-discord', 'enabled' => true, @@ -42,6 +56,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'dropbox' => [ + 'name' => 'Dropbox', 'developers' => 'https://www.dropbox.com/developers/documentation', 'icon' => 'icon-dropbox', 'enabled' => true, @@ -50,6 +65,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'facebook' => [ + 'name' => 'Facebook', 'developers' => 'https://developers.facebook.com/', 'icon' => 'icon-facebook', 'enabled' => true, @@ -58,6 +74,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'github' => [ + 'name' => 'GitHub', 'developers' => 'https://developer.github.com/', 'icon' => 'icon-github-circled', 'enabled' => true, @@ -66,6 +83,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'gitlab' => [ + 'name' => 'GitLab', 'developers' => 'https://docs.gitlab.com/ee/api/', 'icon' => 'icon-gitlab', 'enabled' => true, @@ -74,6 +92,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'google' => [ + 'name' => 'Google', 'developers' => 'https://support.google.com/googleapi/answer/6158849', 'icon' => 'icon-google', 'enabled' => true, @@ -82,6 +101,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'linkedin' => [ + 'name' => 'LinkedIn', 'developers' => 'https://developer.linkedin.com/', 'icon' => 'icon-linkedin', 'enabled' => true, @@ -90,6 +110,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'microsoft' => [ + 'name' => 'Microsoft', 'developers' => 'https://developer.microsoft.com/en-us/', 'icon' => 'icon-windows', 'enabled' => true, @@ -98,6 +119,16 @@ return [ // Ordered by ABC. 'mock' => false, ], 'paypal' => [ + 'name' => 'PayPal', + 'developers' => 'https://developer.paypal.com/docs/api/overview/', + 'icon' => 'icon-paypal', + 'enabled' => true, + 'form' => false, + 'beta' => false, + 'mock' => false + ], + 'paypalSandbox' => [ + 'name' => 'PayPal (Sandbox)', 'developers' => 'https://developer.paypal.com/docs/api/overview/', 'icon' => 'icon-paypal', 'enabled' => true, @@ -106,6 +137,7 @@ return [ // Ordered by ABC. 'mock' => false ], 'salesforce' => [ + 'name' => 'Salesforce', 'developers' => 'https://developer.salesforce.com/docs/', 'icon' => 'icon-salesforce', 'enabled' => true, @@ -114,6 +146,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'slack' => [ + 'name' => 'Slack', 'developers' => 'https://api.slack.com/', 'icon' => 'icon-slack', 'enabled' => true, @@ -122,6 +155,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'spotify' => [ + 'name' => 'Spotify', 'developers' => 'https://developer.spotify.com/documentation/general/guides/authorization-guide/', 'icon' => 'icon-spotify', 'enabled' => true, @@ -130,6 +164,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'twitch' => [ + 'name' => 'Twitch', 'developers' => 'https://dev.twitch.tv/docs/authentication', 'icon' => 'icon-twitch', 'enabled' => true, @@ -138,6 +173,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'vk' => [ + 'name' => 'VK', 'developers' => 'https://vk.com/dev', 'icon' => 'icon-vk', 'enabled' => true, @@ -146,6 +182,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'yahoo' => [ + 'name' => 'Yahoo', 'developers' => 'https://developer.yahoo.com/oauth2/guide/flows_authcode/', 'icon' => 'icon-yahoo', 'enabled' => true, @@ -154,6 +191,7 @@ return [ // Ordered by ABC. 'mock' => false, ], 'yandex' => [ + 'name' => 'Yandex', 'developers' => 'https://tech.yandex.com/oauth/', 'icon' => 'icon-yandex', 'enabled' => true, @@ -162,6 +200,7 @@ return [ // Ordered by ABC. 'mock' => false, ], // 'instagram' => [ + // 'name' => 'Instagram', // 'developers' => 'https://www.instagram.com/developer/', // 'icon' => 'icon-instagram', // 'enabled' => false, @@ -169,6 +208,7 @@ return [ // Ordered by ABC. // 'mock' => false, // ], // 'twitter' => [ + // 'name' => 'twitter', // 'developers' => 'https://developer.twitter.com/', // 'icon' => 'icon-twitter', // 'enabled' => false, @@ -177,6 +217,7 @@ return [ // Ordered by ABC. // ], // Keep Last 'mock' => [ + 'name' => 'Mock', 'developers' => 'https://appwrite.io', 'icon' => 'icon-appwrite', 'enabled' => true, diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index ade11aeb0e..b29a2401e3 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -29,8 +29,8 @@ use DeviceDetector\DeviceDetector; use GeoIp2\Database\Reader; use Utopia\Validator\ArrayList; -$oauthDefaultSuccess = $request->getServer('_APP_HOME').'/auth/oauth2/success'; -$oauthDefaultFailure = $request->getServer('_APP_HOME').'/auth/oauth2/failure'; +$oauthDefaultSuccess = '/auth/oauth2/success'; +$oauthDefaultFailure = '/auth/oauth2/failure'; $oauth2Keys = []; @@ -78,9 +78,8 @@ $utopia->post('/v1/account') } } - $profile = $projectDB->getCollection([ // Get user by email address + $profile = $projectDB->getCollectionFirst([ // Get user by email address 'limit' => 1, - 'first' => true, 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_USERS, 'email='.$email, @@ -153,9 +152,8 @@ $utopia->post('/v1/account/sessions') ->action( function ($email, $password) use ($response, $request, $projectDB, $audit, $webhook) { $protocol = Config::getParam('protocol'); - $profile = $projectDB->getCollection([ // Get user by email address + $profile = $projectDB->getCollectionFirst([ // Get user by email address 'limit' => 1, - 'first' => true, 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_USERS, 'email='.$email, @@ -409,9 +407,8 @@ $utopia->get('/v1/account/sessions/oauth2/:provider/redirect') $projectDB->deleteDocument($current); //throw new Exception('User already logged in', 401); } - $user = (empty($user->getId())) ? $projectDB->getCollection([ // Get user by provider id + $user = (empty($user->getId())) ? $projectDB->getCollectionFirst([ // Get user by provider id 'limit' => 1, - 'first' => true, 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_USERS, 'oauth2'.\ucfirst($provider).'='.$oauth2ID, @@ -422,9 +419,8 @@ $utopia->get('/v1/account/sessions/oauth2/:provider/redirect') $name = $oauth2->getUserName($accessToken); $email = $oauth2->getUserEmail($accessToken); - $user = $projectDB->getCollection([ // Get user by provider email address + $user = $projectDB->getCollectionFirst([ // Get user by provider email address 'limit' => 1, - 'first' => true, 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_USERS, 'email='.$email, @@ -500,8 +496,9 @@ $utopia->get('/v1/account/sessions/oauth2/:provider/redirect') ->addHeader('X-Fallback-Cookies', \json_encode([Auth::$cookieName => Auth::encodeSession($user->getId(), $secret)])) ; } - - if ($state['success'] === $oauthDefaultSuccess) { // Add keys for non-web platforms + + // Add keys for non-web platforms - TODO - add verification phase to aviod session sniffing + if (parse_url($state['success'], PHP_URL_PATH) === $oauthDefaultSuccess) { $state['success'] = URLParser::parse($state['success']); $query = URLParser::parseQuery($state['success']['query']); $query['project'] = $project->getId(); @@ -774,9 +771,8 @@ $utopia->patch('/v1/account/email') throw new Exception('Invalid credentials', 401); } - $profile = $projectDB->getCollection([ // Get user by email address + $profile = $projectDB->getCollectionFirst([ // Get user by email address 'limit' => 1, - 'first' => true, 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_USERS, 'email='.$email, @@ -1030,9 +1026,8 @@ $utopia->post('/v1/account/recovery') ->param('url', '', function () use ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.') ->action( function ($email, $url) use ($request, $response, $projectDB, $mail, $audit, $project) { - $profile = $projectDB->getCollection([ // Get user by email address + $profile = $projectDB->getCollectionFirst([ // Get user by email address 'limit' => 1, - 'first' => true, 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_USERS, 'email='.$email, @@ -1136,9 +1131,8 @@ $utopia->put('/v1/account/recovery') throw new Exception('Passwords must match', 400); } - $profile = $projectDB->getCollection([ // Get user by email address + $profile = $projectDB->getCollectionFirst([ // Get user by email address 'limit' => 1, - 'first' => true, 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_USERS, '$id='.$userId, @@ -1288,9 +1282,8 @@ $utopia->put('/v1/account/verification') ->param('secret', '', function () { return new Text(256); }, 'Valid verification token.') ->action( function ($userId, $secret) use ($response, $user, $projectDB, $audit) { - $profile = $projectDB->getCollection([ // Get user by email address + $profile = $projectDB->getCollectionFirst([ // Get user by email address 'limit' => 1, - 'first' => true, 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_USERS, '$id='.$userId, diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index 90f8ac34c8..9e888f7f7d 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -3,6 +3,7 @@ global $utopia, $request, $response; use Utopia\Exception; +use Utopia\Validator\Boolean; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; use Utopia\Validator\Range; @@ -364,7 +365,7 @@ $utopia->get('/v1/avatars/qr') ->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) - ->param('download', 0, function () { return new Range(0, 1); }, 'Return resulting image with \'Content-Disposition: attachment \' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.', true) + ->param('download', false, function () { return new Boolean(true); }, 'Return resulting image with \'Content-Disposition: attachment \' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.', true) ->label('scope', 'avatars.read') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'avatars') @@ -373,6 +374,8 @@ $utopia->get('/v1/avatars/qr') ->label('sdk.description', '/docs/references/avatars/get-qr.md') ->action( function ($text, $size, $margin, $download) use ($response) { + $download = ($download === '1' || $download === 'true' || $download === 1 || $download === true); + $renderer = new ImageRenderer( new RendererStyle($size, $margin), new ImagickImageBackEnd('png', 100) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index b4b4479b89..c6accbb269 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -5,14 +5,15 @@ global $utopia, $register, $request, $response, $webhook, $audit, $projectDB; use Utopia\App; use Utopia\Exception; use Utopia\Response; +use Utopia\Validator\Boolean; use Utopia\Validator\Range; use Utopia\Validator\WhiteList; use Utopia\Validator\Text; use Utopia\Validator\ArrayList; use Utopia\Validator\JSON; -use Utopia\Locale\Locale; -use Utopia\Audit\Audit; -use Utopia\Audit\Adapters\MySQL as AuditAdapter; +// use Utopia\Locale\Locale; +// use Utopia\Audit\Audit; +// use Utopia\Audit\Adapters\MySQL as AuditAdapter; use Appwrite\Database\Database; use Appwrite\Database\Document; use Appwrite\Database\Validator\UID; @@ -22,8 +23,9 @@ use Appwrite\Database\Validator\Collection; use Appwrite\Database\Validator\Authorization; use Appwrite\Database\Exception\Authorization as AuthorizationException; use Appwrite\Database\Exception\Structure as StructureException; -use DeviceDetector\DeviceDetector; -use GeoIp2\Database\Reader; + +// use DeviceDetector\DeviceDetector; +// use GeoIp2\Database\Reader; $utopia->post('/v1/database/collections') ->desc('Create Collection') @@ -462,10 +464,8 @@ $utopia->get('/v1/database/collections/:collectionId/documents') ->param('orderType', 'ASC', function () { return new WhiteList(array('DESC', 'ASC')); }, 'Order direction. Possible values are DESC for descending order, or ASC for ascending order.', true) ->param('orderCast', 'string', function () { return new WhiteList(array('int', 'string', 'date', 'time', 'datetime')); }, 'Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string.', true) ->param('search', '', function () { return new Text(256); }, 'Search query. Enter any free text search. The database will try to find a match against all document attributes and children.', true) - ->param('first', 0, function () { return new Range(0, 1); }, 'Return only the first document. Pass 1 for true or 0 for false. The default value is 0.', true) - ->param('last', 0, function () { return new Range(0, 1); }, 'Return only the last document. Pass 1 for true or 0 for false. The default value is 0.', true) ->action( - function ($collectionId, $filters, $offset, $limit, $orderField, $orderType, $orderCast, $search, $first, $last) use ($response, $projectDB, $utopia) { + function ($collectionId, $filters, $offset, $limit, $orderField, $orderType, $orderCast, $search) use ($response, $projectDB, $utopia) { $collection = $projectDB->getDocument($collectionId, false); if (\is_null($collection->getId()) || Database::SYSTEM_COLLECTION_COLLECTIONS != $collection->getCollection()) { @@ -479,38 +479,32 @@ $utopia->get('/v1/database/collections/:collectionId/documents') 'orderType' => $orderType, 'orderCast' => $orderCast, 'search' => $search, - 'first' => (bool) $first, - 'last' => (bool) $last, 'filters' => \array_merge($filters, [ '$collection='.$collectionId, ]), ]); - if ($first || $last) { - $response->json((!empty($list) ? $list->getArrayCopy() : [])); - } else { - if ($utopia->isDevelopment()) { - $collection - ->setAttribute('debug', $projectDB->getDebug()) - ->setAttribute('limit', $limit) - ->setAttribute('offset', $offset) - ->setAttribute('orderField', $orderField) - ->setAttribute('orderType', $orderType) - ->setAttribute('orderCast', $orderCast) - ->setAttribute('filters', $filters) - ; - } - + if ($utopia->isDevelopment()) { $collection - ->setAttribute('sum', $projectDB->getSum()) - ->setAttribute('documents', $list) + ->setAttribute('debug', $projectDB->getDebug()) + ->setAttribute('limit', $limit) + ->setAttribute('offset', $offset) + ->setAttribute('orderField', $orderField) + ->setAttribute('orderType', $orderType) + ->setAttribute('orderCast', $orderCast) + ->setAttribute('filters', $filters) ; - - /* - * View - */ - $response->json($collection->getArrayCopy(/*['$id', '$collection', 'name', 'documents']*/[], ['rules'])); } + + $collection + ->setAttribute('sum', $projectDB->getSum()) + ->setAttribute('documents', $list) + ; + + /* + * View + */ + $response->json($collection->getArrayCopy(/*['$id', '$collection', 'name', 'documents']*/[], ['rules'])); } ); diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 3311abbd0b..bd49422398 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -5,10 +5,10 @@ global $utopia, $request, $response, $register, $user, $consoleDB, $projectDB, $ use Utopia\Exception; use Utopia\Response; use Utopia\Validator\ArrayList; +use Utopia\Validator\Boolean; use Utopia\Validator\Domain as DomainValidator; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; -use Utopia\Validator\Range; use Utopia\Validator\URL; use Utopia\Config\Config; use Utopia\Domains\Domain; @@ -454,7 +454,7 @@ $utopia->post('/v1/projects/:projectId/webhooks') ->param('name', null, function () { return new Text(256); }, 'Webhook name.') ->param('events', null, function () { return new ArrayList(new Text(256)); }, 'Webhook events list.') ->param('url', null, function () { return new Text(2000); }, 'Webhook URL.') - ->param('security', null, function () { return new Range(0, 1); }, 'Certificate verification, 0 for disabled or 1 for enabled.') + ->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') ->param('httpUser', '', function () { return new Text(256); }, 'Webhook HTTP user.', true) ->param('httpPass', '', function () { return new Text(256); }, 'Webhook HTTP password.', true) ->action( @@ -465,6 +465,7 @@ $utopia->post('/v1/projects/:projectId/webhooks') throw new Exception('Project not found', 404); } + $security = ($security === '1' || $security === 'true' || $security === 1 || $security === true); $key = $request->getServer('_APP_OPENSSL_KEY_V1'); $iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM)); $tag = null; @@ -587,8 +588,7 @@ $utopia->put('/v1/projects/:projectId/webhooks/:webhookId') ->param('name', null, function () { return new Text(256); }, 'Webhook name.') ->param('events', null, function () { return new ArrayList(new Text(256)); }, 'Webhook events list.') ->param('url', null, function () { return new Text(2000); }, 'Webhook URL.') - ->param('security', null, function () { return new Range(0, 1); }, 'Certificate verification, 0 for disabled or 1 for enabled.') - ->param('httpUser', '', function () { return new Text(256); }, 'Webhook HTTP user.', true) + ->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') ->param('httpUser', '', function () { return new Text(256); }, 'Webhook HTTP user.', true) ->param('httpPass', '', function () { return new Text(256); }, 'Webhook HTTP password.', true) ->action( function ($projectId, $webhookId, $name, $events, $url, $security, $httpUser, $httpPass) use ($request, $response, $consoleDB) { @@ -598,6 +598,7 @@ $utopia->put('/v1/projects/:projectId/webhooks/:webhookId') throw new Exception('Project not found', 404); } + $security = ($security === '1' || $security === 'true' || $security === 1 || $security === true); $key = $request->getServer('_APP_OPENSSL_KEY_V1'); $iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM)); $tag = null; @@ -835,8 +836,7 @@ $utopia->post('/v1/projects/:projectId/tasks') ->param('name', null, function () { return new Text(256); }, 'Task name.') ->param('status', null, function () { return new WhiteList(['play', 'pause']); }, 'Task status.') ->param('schedule', null, function () { return new Cron(); }, 'Task schedule CRON syntax.') - ->param('security', null, function () { return new Range(0, 1); }, 'Certificate verification, 0 for disabled or 1 for enabled.') - ->param('httpMethod', '', function () { return new WhiteList(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS', 'TRACE', 'CONNECT']); }, 'Task HTTP method.') + ->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') ->param('httpMethod', '', function () { return new WhiteList(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS', 'TRACE', 'CONNECT']); }, 'Task HTTP method.') ->param('httpUrl', '', function () { return new URL(); }, 'Task HTTP URL') ->param('httpHeaders', null, function () { return new ArrayList(new Text(256)); }, 'Task HTTP headers list.', true) ->param('httpUser', '', function () { return new Text(256); }, 'Task HTTP user.', true) @@ -852,6 +852,7 @@ $utopia->post('/v1/projects/:projectId/tasks') $cron = CronExpression::factory($schedule); $next = ($status == 'play') ? $cron->getNextRunDate()->format('U') : null; + $security = ($security === '1' || $security === 'true' || $security === 1 || $security === true); $key = $request->getServer('_APP_OPENSSL_KEY_V1'); $iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM)); $tag = null; @@ -985,7 +986,7 @@ $utopia->put('/v1/projects/:projectId/tasks/:taskId') ->param('name', null, function () { return new Text(256); }, 'Task name.') ->param('status', null, function () { return new WhiteList(['play', 'pause']); }, 'Task status.') ->param('schedule', null, function () { return new Cron(); }, 'Task schedule CRON syntax.') - ->param('security', null, function () { return new Range(0, 1); }, 'Certificate verification, 0 for disabled or 1 for enabled.') + ->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') ->param('httpMethod', '', function () { return new WhiteList(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS', 'TRACE', 'CONNECT']); }, 'Task HTTP method.') ->param('httpUrl', '', function () { return new URL(); }, 'Task HTTP URL.') ->param('httpHeaders', null, function () { return new ArrayList(new Text(256)); }, 'Task HTTP headers list.', true) @@ -1008,6 +1009,7 @@ $utopia->put('/v1/projects/:projectId/tasks/:taskId') $cron = CronExpression::factory($schedule); $next = ($status == 'play') ? $cron->getNextRunDate()->format('U') : null; + $security = ($security === '1' || $security === 'true' || $security === 1 || $security === true); $key = $request->getServer('_APP_OPENSSL_KEY_V1'); $iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM)); $tag = null; diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index d5a7071449..d69a39bed6 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -237,9 +237,8 @@ $utopia->post('/v1/teams/:teamId/memberships') ], ]); - $invitee = $projectDB->getCollection([ // Get user by email address + $invitee = $projectDB->getCollectionFirst([ // Get user by email address 'limit' => 1, - 'first' => true, 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_USERS, 'email='.$email, @@ -468,9 +467,8 @@ $utopia->patch('/v1/teams/:teamId/memberships/:inviteId/status') } if (empty($user->getId())) { - $user = $projectDB->getCollection([ // Get user + $user = $projectDB->getCollectionFirst([ // Get user 'limit' => 1, - 'first' => true, 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_USERS, '$id='.$userId, diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index d60ad57dd4..dd02524bdc 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -34,9 +34,8 @@ $utopia->post('/v1/users') ->param('name', '', function () { return new Text(100); }, 'User name.', true) ->action( function ($email, $password, $name) use ($response, $projectDB) { - $profile = $projectDB->getCollection([ // Get user by email address + $profile = $projectDB->getCollectionFirst([ // Get user by email address 'limit' => 1, - 'first' => true, 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_USERS, 'email='.$email, diff --git a/app/controllers/web/home.php b/app/controllers/web/home.php index fbd343ecc8..cf29b5d495 100644 --- a/app/controllers/web/home.php +++ b/app/controllers/web/home.php @@ -167,7 +167,9 @@ $utopia->get('/open-api-2.json') ->param('extensions', 0, function () {return new Range(0, 1);}, 'Show extra data.', true) ->param('tests', 0, function () {return new Range(0, 1);}, 'Include only test services.', true) ->action( - function ($platform, $extensions, $tests) use ($response, $request, $utopia, $services) { + function ($platform, $extensions, $tests) use ($response, $request, $utopia) { + $services = Config::getParam('services', []); + function fromCamelCase($input) { \preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches); @@ -455,6 +457,10 @@ $utopia->get('/open-api-2.json') $node['type'] = 'string'; $node['x-example'] = '['.\strtoupper(fromCamelCase($node['name'])).']'; break; + case 'Utopia\Validator\Boolean': + $node['type'] = 'boolean'; + $node['x-example'] = false; + break; case 'Appwrite\Database\Validator\UID': $node['type'] = 'string'; $node['x-example'] = '['.\strtoupper(fromCamelCase($node['name'])).']'; diff --git a/app/init.php b/app/init.php index c6f531e083..6a9c60b7af 100644 --- a/app/init.php +++ b/app/init.php @@ -62,6 +62,8 @@ Config::load('providers', __DIR__.'/../app/config/providers.php'); Config::load('platforms', __DIR__.'/../app/config/platforms.php'); Config::load('locales', __DIR__.'/../app/config/locales.php'); Config::load('collections', __DIR__.'/../app/config/collections.php'); +Config::load('roles', __DIR__.'/../app/config/roles.php'); // User roles and scopes +Config::load('services', __DIR__.'/../app/config/services.php'); // List of services Config::setParam('env', $utopia->getMode()); Config::setParam('domain', $request->getServer('HTTP_HOST', '')); @@ -200,7 +202,6 @@ Locale::setLanguage('nl', include __DIR__.'/config/locales/nl.php'); Locale::setLanguage('no', include __DIR__.'/config/locales/no.php'); Locale::setLanguage('ph', include __DIR__.'/config/locales/ph.php'); Locale::setLanguage('pl', include __DIR__.'/config/locales/pl.php'); -Locale::setLanguage('pn', include __DIR__.'/config/locales/pn.php'); Locale::setLanguage('pt-br', include __DIR__.'/config/locales/pt-br.php'); Locale::setLanguage('pt-pt', include __DIR__.'/config/locales/pt-pt.php'); Locale::setLanguage('ro', include __DIR__.'/config/locales/ro.php'); diff --git a/app/views/console/users/index.phtml b/app/views/console/users/index.phtml index a391f67e09..321220d0af 100644 --- a/app/views/console/users/index.phtml +++ b/app/views/console/users/index.phtml @@ -309,13 +309,14 @@ $providers = $this->getParam('providers', []); if (isset($data['enabled']) && !$data['enabled']) { continue; } if (isset($data['mock']) && $data['mock']) { continue; } $form = (isset($data['form'])) ? $data['form'] : false; + $name = (isset($data['name'])) ? $data['name'] : 'Unknown'; $beta = (isset($data['beta'])) ? $data['beta'] : false; ?>