diff --git a/CHANGES.md b/CHANGES.md index cbd6a58996..ca6248ff8d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,10 +6,14 @@ - Added option to force HTTPS connection to the Appwrite server (_APP_OPTIONS_FORCE_HTTPS) - Added Google Fonts to Appwrite for offline availability - Added a new route in the Avatars API to get user initials avatar +- Added option to delete team from the console +- Added option to view team members from the console +- Added option to join a user to any team from the console ## Bug Fixes - Fixed output of /v1/health/queue/certificates returning wrong data +- Fixed bug where team members count was wrong in some cases - Fixed network calculation for uploaded files - Fixed a UI bug preventing float values in numeric fields diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index fad09b695e..ded2445faa 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -215,7 +215,7 @@ $utopia->post('/v1/teams/:teamId/memberships') ->param('roles', [], function () { return new ArrayList(new Text(128)); }, 'Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](/docs/permissions).') ->param('url', '', function () use ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the invitation 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.') // TODO add our own built-in confirm page ->action( - function ($teamId, $email, $name, $roles, $url) use ($response, $register, $project, $user, $audit, $projectDB) { + function ($teamId, $email, $name, $roles, $url) use ($response, $register, $project, $user, $audit, $projectDB, $mode) { $name = (empty($name)) ? $email : $name; $team = $projectDB->getDocument($teamId); @@ -285,7 +285,7 @@ $utopia->post('/v1/teams/:teamId/memberships') } } - if (!$isOwner) { + if (!$isOwner && (APP_MODE_ADMIN !== $mode)) { throw new Exception('User is not allowed to send invitations for this team', 401); } @@ -302,11 +302,18 @@ $utopia->post('/v1/teams/:teamId/memberships') 'roles' => $roles, 'invited' => time(), 'joined' => 0, - 'confirm' => false, + 'confirm' => (APP_MODE_ADMIN === $mode), 'secret' => Auth::hash($secret), ]); - $membership = $projectDB->createDocument($membership->getArrayCopy()); + if(APP_MODE_ADMIN === $mode) { // Allow admin to create membership + Authorization::disable(); + $membership = $projectDB->createDocument($membership->getArrayCopy()); + Authorization::reset(); + } + else { + $membership = $projectDB->createDocument($membership->getArrayCopy()); + } if (false === $membership) { throw new Exception('Failed saving membership to DB', 500); @@ -334,7 +341,9 @@ $utopia->post('/v1/teams/:teamId/memberships') $mail->AltBody = strip_tags($body->render()); try { - $mail->send(); + if(APP_MODE_ADMIN !== $mode) { // No need in comfirmation when in admin mode + $mail->send(); + } } catch (\Exception $error) { throw new Exception('Error sending mail: ' . $error->getMessage(), 500); } @@ -371,8 +380,12 @@ $utopia->get('/v1/teams/:teamId/memberships') ->label('sdk.method', 'getMemberships') ->label('sdk.description', '/docs/references/teams/get-team-members.md') ->param('teamId', '', function () { return new UID(); }, 'Team unique ID.') + ->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results.', true) + ->param('limit', 25, function () { return new Range(0, 100); }, 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true) + ->param('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true) + ->param('orderType', 'ASC', function () { return new WhiteList(['ASC', 'DESC']); }, 'Order result by ASC or DESC order.', true) ->action( - function ($teamId) use ($response, $projectDB) { + function ($teamId, $search, $limit, $offset, $orderType) use ($response, $projectDB) { $team = $projectDB->getDocument($teamId); if (empty($team->getId()) || Database::SYSTEM_COLLECTION_TEAMS != $team->getCollection()) { @@ -380,8 +393,12 @@ $utopia->get('/v1/teams/:teamId/memberships') } $memberships = $projectDB->getCollection([ - 'limit' => 50, - 'offset' => 0, + 'limit' => $limit, + 'offset' => $offset, + 'orderField' => 'joined', + 'orderType' => $orderType, + 'orderCast' => 'int', + 'search' => $search, 'filters' => [ '$collection='.Database::SYSTEM_COLLECTION_MEMBERSHIPS, 'teamId='.$teamId, @@ -408,15 +425,8 @@ $utopia->get('/v1/teams/:teamId/memberships') ])); } - usort($users, function ($a, $b) { - if ($a['joined'] === 0 || $b['joined'] === 0) { - return $b['joined'] - $a['joined']; - } + $response->json(['sum' => $projectDB->getSum(), 'memberships' => $users]); - return $a['joined'] - $b['joined']; - }); - - $response->json($users); } ); @@ -583,9 +593,11 @@ $utopia->delete('/v1/teams/:teamId/memberships/:inviteId') throw new Exception('Failed to remove membership from DB', 500); } - $team = $projectDB->updateDocument(array_merge($team->getArrayCopy(), [ - 'sum' => $team->getAttribute('sum', 0) - 1, - ])); + if ($membership->getAttribute('confirm')) { // Count only confirmed members + $team = $projectDB->updateDocument(array_merge($team->getArrayCopy(), [ + 'sum' => $team->getAttribute('sum', 0) - 1, + ])); + } if (false === $team) { throw new Exception('Failed saving team to DB', 500); diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php index 480c4ff9ba..d90966ba72 100644 --- a/app/controllers/web/console.php +++ b/app/controllers/web/console.php @@ -277,14 +277,26 @@ $utopia->get('/console/users') ->setParam('body', $page); }); -$utopia->get('/console/users/view') +$utopia->get('/console/users/user') ->desc('Platform console project user') ->label('permission', 'public') ->label('scope', 'console') ->action(function () use ($layout) { - $page = new View(__DIR__.'/../../views/console/users/view.phtml'); + $page = new View(__DIR__.'/../../views/console/users/user.phtml'); $layout - ->setParam('title', APP_NAME.' - View User') + ->setParam('title', APP_NAME.' - User') + ->setParam('body', $page); + }); + +$utopia->get('/console/users/teams/team') + ->desc('Platform console project team') + ->label('permission', 'public') + ->label('scope', 'console') + ->action(function () use ($layout) { + $page = new View(__DIR__.'/../../views/console/users/team.phtml'); + + $layout + ->setParam('title', APP_NAME.' - Team') ->setParam('body', $page); }); diff --git a/app/sdks/client-web/README.md b/app/sdks/client-web/README.md index e59480b4a9..093783ab41 100644 --- a/app/sdks/client-web/README.md +++ b/app/sdks/client-web/README.md @@ -1,7 +1,7 @@ # Appwrite Web SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-js.svg?v=1) -![Version](https://img.shields.io/badge/api%20version-0.6.1-blue.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1) Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Web SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. diff --git a/app/sdks/client-web/docs/examples/account/create-o-auth2session.md b/app/sdks/client-web/docs/examples/account/create-o-auth2session.md index 5cc825a273..0c7430741c 100644 --- a/app/sdks/client-web/docs/examples/account/create-o-auth2session.md +++ b/app/sdks/client-web/docs/examples/account/create-o-auth2session.md @@ -5,7 +5,7 @@ sdk .setProject('5df5acd0d48c2') // Your project ID ; -let promise = sdk.account.createOAuth2Session('bitbucket'); +let promise = sdk.account.createOAuth2Session('amazon'); promise.then(function (response) { console.log(response); // Success diff --git a/app/sdks/client-web/src/sdk.js b/app/sdks/client-web/src/sdk.js index 0d7a7deaab..a423ae9cf9 100644 --- a/app/sdks/client-web/src/sdk.js +++ b/app/sdks/client-web/src/sdk.js @@ -276,10 +276,10 @@ * * Use this endpoint to allow a new user to register a new account in your * project. After the user registration completes successfully, you can use - * the [/account/verfication](/docs/account#createVerification) route to start - * verifying the user email address. To allow your new user to login to his - * new account, you need to create a new [account - * session](/docs/account#createSession). + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow your new user to login + * to his new account, you need to create a new [account + * session](/docs/client/account#createSession). * * @param {string} email * @param {string} password @@ -522,7 +522,7 @@ * When the user clicks the confirmation link he is redirected back to your * app password reset URL with the secret key and email address values * attached to the URL query string. Use the query string params to submit a - * request to the [PUT /account/recovery](/docs/account#updateRecovery) + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) * endpoint to complete the process. * * @param {string} email @@ -563,7 +563,7 @@ * Use this endpoint to complete the user account password reset. Both the * **userId** and **secret** arguments will be passed as query parameters to * the redirect URL you have provided when sending your request to the [POST - * /account/recovery](/docs/account#createRecovery) endpoint. + * /account/recovery](/docs/client/account#createRecovery) endpoint. * * Please note that in order to avoid a [Redirect * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) @@ -772,7 +772,7 @@ * should redirect the user back for your app and allow you to complete the * verification process by verifying both the **userId** and **secret** * parameters. Learn more about how to [complete the verification - * process](/docs/account#updateAccountVerification). + * process](/docs/client/account#updateAccountVerification). * * Please note that in order to avoid a [Redirect * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) @@ -1168,7 +1168,10 @@ /** * Create Document * - * Create a new Document. + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. * * @param {string} collectionId * @param {object} data @@ -1942,10 +1945,14 @@ * for this list of resources. * * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType * @throws {Error} * @return {Promise} */ - getMemberships: function(teamId) { + getMemberships: function(teamId, search = '', limit = 25, offset = 0, orderType = 'ASC') { if(teamId === undefined) { throw new Error('Missing required parameter: "teamId"'); } @@ -1954,6 +1961,22 @@ let payload = {}; + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + return http .get(path, { 'content-type': 'application/json', @@ -1969,8 +1992,8 @@ * * Use the 'URL' parameter to redirect the user from the invitation email back * to your app. When the user is redirected, use the [Update Team Membership - * Status](/docs/teams#updateMembershipStatus) endpoint to allow the user to - * accept the invitation to the team. + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. * * Please note that in order to avoid a [Redirect * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) diff --git a/app/sdks/client-web/src/sdk.min.js b/app/sdks/client-web/src/sdk.min.js index 113a3402b8..bef842f31a 100644 --- a/app/sdks/client-web/src/sdk.min.js +++ b/app/sdks/client-web/src/sdk.min.js @@ -148,8 +148,12 @@ let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payloa if(name===undefined){throw new Error('Missing required parameter: "name"')} let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};if(name){payload.name=name} return http.put(path,{'content-type':'application/json',},payload)},delete:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} -let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getMemberships:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} -let path='/teams/{teamId}/memberships'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},createMembership:function(teamId,email,roles,url,name=''){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} +let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getMemberships:function(teamId,search='',limit=25,offset=0,orderType='ASC'){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} +let path='/teams/{teamId}/memberships'.replace(new RegExp('{teamId}','g'),teamId);let payload={};if(search){payload.search=search} +if(limit){payload.limit=limit} +if(offset){payload.offset=offset} +if(orderType){payload.orderType=orderType} +return http.get(path,{'content-type':'application/json',},payload)},createMembership:function(teamId,email,roles,url,name=''){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} if(email===undefined){throw new Error('Missing required parameter: "email"')} if(roles===undefined){throw new Error('Missing required parameter: "roles"')} if(url===undefined){throw new Error('Missing required parameter: "url"')} diff --git a/app/sdks/client-web/types/index.d.ts b/app/sdks/client-web/types/index.d.ts index f2bc108bc4..2715af9f8d 100644 --- a/app/sdks/client-web/types/index.d.ts +++ b/app/sdks/client-web/types/index.d.ts @@ -64,10 +64,10 @@ declare namespace Appwrite { * * Use this endpoint to allow a new user to register a new account in your * project. After the user registration completes successfully, you can use - * the [/account/verfication](/docs/account#createVerification) route to start - * verifying the user email address. To allow your new user to login to his - * new account, you need to create a new [account - * session](/docs/account#createSession). + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow your new user to login + * to his new account, you need to create a new [account + * session](/docs/client/account#createSession). * * @param {string} email * @param {string} password @@ -170,7 +170,7 @@ declare namespace Appwrite { * When the user clicks the confirmation link he is redirected back to your * app password reset URL with the secret key and email address values * attached to the URL query string. Use the query string params to submit a - * request to the [PUT /account/recovery](/docs/account#updateRecovery) + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) * endpoint to complete the process. * * @param {string} email @@ -186,7 +186,7 @@ declare namespace Appwrite { * Use this endpoint to complete the user account password reset. Both the * **userId** and **secret** arguments will be passed as query parameters to * the redirect URL you have provided when sending your request to the [POST - * /account/recovery](/docs/account#createRecovery) endpoint. + * /account/recovery](/docs/client/account#createRecovery) endpoint. * * Please note that in order to avoid a [Redirect * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) @@ -276,7 +276,7 @@ declare namespace Appwrite { * should redirect the user back for your app and allow you to complete the * verification process by verifying both the **userId** and **secret** * parameters. Learn more about how to [complete the verification - * process](/docs/account#updateAccountVerification). + * process](/docs/client/account#updateAccountVerification). * * Please note that in order to avoid a [Redirect * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) @@ -431,7 +431,10 @@ declare namespace Appwrite { /** * Create Document * - * Create a new Document. + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. * * @param {string} collectionId * @param {object} data @@ -758,10 +761,14 @@ declare namespace Appwrite { * for this list of resources. * * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType * @throws {Error} * @return {Promise} */ - getMemberships(teamId: string): Promise; + getMemberships(teamId: string, search: string, limit: number, offset: number, orderType: string): Promise; /** * Create Team Membership @@ -772,8 +779,8 @@ declare namespace Appwrite { * * Use the 'URL' parameter to redirect the user from the invitation email back * to your app. When the user is redirected, use the [Update Team Membership - * Status](/docs/teams#updateMembershipStatus) endpoint to allow the user to - * accept the invitation to the team. + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. * * Please note that in order to avoid a [Redirect * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) diff --git a/app/sdks/console-web/README.md b/app/sdks/console-web/README.md index 8d44e2769b..68b7e8ff9c 100644 --- a/app/sdks/console-web/README.md +++ b/app/sdks/console-web/README.md @@ -1,7 +1,7 @@ # Appwrite Console SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?v=1) -![Version](https://img.shields.io/badge/api%20version-0.6.1-blue.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1) Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. diff --git a/app/sdks/console-web/docs/examples/account/create-o-auth2session.md b/app/sdks/console-web/docs/examples/account/create-o-auth2session.md index bea25a368f..4a3523693f 100644 --- a/app/sdks/console-web/docs/examples/account/create-o-auth2session.md +++ b/app/sdks/console-web/docs/examples/account/create-o-auth2session.md @@ -6,7 +6,7 @@ sdk .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; -let promise = sdk.account.createOAuth2Session('bitbucket'); +let promise = sdk.account.createOAuth2Session('amazon'); promise.then(function (response) { console.log(response); // Success diff --git a/app/sdks/console-web/docs/examples/projects/update-o-auth2.md b/app/sdks/console-web/docs/examples/projects/update-o-auth2.md index 4a82548a6a..479c5e9d30 100644 --- a/app/sdks/console-web/docs/examples/projects/update-o-auth2.md +++ b/app/sdks/console-web/docs/examples/projects/update-o-auth2.md @@ -6,7 +6,7 @@ sdk .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key ; -let promise = sdk.projects.updateOAuth2('[PROJECT_ID]', 'bitbucket'); +let promise = sdk.projects.updateOAuth2('[PROJECT_ID]', 'amazon'); promise.then(function (response) { console.log(response); // Success diff --git a/app/sdks/console-web/src/sdk.js b/app/sdks/console-web/src/sdk.js index 86e219cde5..08f0501f23 100644 --- a/app/sdks/console-web/src/sdk.js +++ b/app/sdks/console-web/src/sdk.js @@ -312,10 +312,10 @@ * * Use this endpoint to allow a new user to register a new account in your * project. After the user registration completes successfully, you can use - * the [/account/verfication](/docs/account#createVerification) route to start - * verifying the user email address. To allow your new user to login to his - * new account, you need to create a new [account - * session](/docs/account#createSession). + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow your new user to login + * to his new account, you need to create a new [account + * session](/docs/client/account#createSession). * * @param {string} email * @param {string} password @@ -558,7 +558,7 @@ * When the user clicks the confirmation link he is redirected back to your * app password reset URL with the secret key and email address values * attached to the URL query string. Use the query string params to submit a - * request to the [PUT /account/recovery](/docs/account#updateRecovery) + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) * endpoint to complete the process. * * @param {string} email @@ -599,7 +599,7 @@ * Use this endpoint to complete the user account password reset. Both the * **userId** and **secret** arguments will be passed as query parameters to * the redirect URL you have provided when sending your request to the [POST - * /account/recovery](/docs/account#createRecovery) endpoint. + * /account/recovery](/docs/client/account#createRecovery) endpoint. * * Please note that in order to avoid a [Redirect * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) @@ -810,7 +810,7 @@ * should redirect the user back for your app and allow you to complete the * verification process by verifying both the **userId** and **secret** * parameters. Learn more about how to [complete the verification - * process](/docs/account#updateAccountVerification). + * process](/docs/client/account#updateAccountVerification). * * Please note that in order to avoid a [Redirect * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) @@ -1421,7 +1421,10 @@ /** * Create Document * - * Create a new Document. + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. * * @param {string} collectionId * @param {object} data @@ -3753,10 +3756,14 @@ * for this list of resources. * * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType * @throws {Error} * @return {Promise} */ - getMemberships: function(teamId) { + getMemberships: function(teamId, search = '', limit = 25, offset = 0, orderType = 'ASC') { if(teamId === undefined) { throw new Error('Missing required parameter: "teamId"'); } @@ -3765,6 +3772,22 @@ let payload = {}; + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + return http .get(path, { 'content-type': 'application/json', @@ -3780,8 +3803,8 @@ * * Use the 'URL' parameter to redirect the user from the invitation email back * to your app. When the user is redirected, use the [Update Team Membership - * Status](/docs/teams#updateMembershipStatus) endpoint to allow the user to - * accept the invitation to the team. + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. * * Please note that in order to avoid a [Redirect * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) diff --git a/app/sdks/console-web/src/sdk.min.js b/app/sdks/console-web/src/sdk.min.js index b43f612ff4..f0951f5030 100644 --- a/app/sdks/console-web/src/sdk.min.js +++ b/app/sdks/console-web/src/sdk.min.js @@ -319,8 +319,12 @@ let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payloa if(name===undefined){throw new Error('Missing required parameter: "name"')} let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};if(name){payload.name=name} return http.put(path,{'content-type':'application/json',},payload)},delete:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} -let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getMemberships:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} -let path='/teams/{teamId}/memberships'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},createMembership:function(teamId,email,roles,url,name=''){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} +let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getMemberships:function(teamId,search='',limit=25,offset=0,orderType='ASC'){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} +let path='/teams/{teamId}/memberships'.replace(new RegExp('{teamId}','g'),teamId);let payload={};if(search){payload.search=search} +if(limit){payload.limit=limit} +if(offset){payload.offset=offset} +if(orderType){payload.orderType=orderType} +return http.get(path,{'content-type':'application/json',},payload)},createMembership:function(teamId,email,roles,url,name=''){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} if(email===undefined){throw new Error('Missing required parameter: "email"')} if(roles===undefined){throw new Error('Missing required parameter: "roles"')} if(url===undefined){throw new Error('Missing required parameter: "url"')} diff --git a/app/sdks/console-web/types/index.d.ts b/app/sdks/console-web/types/index.d.ts index 08f42c7cf4..65da150013 100644 --- a/app/sdks/console-web/types/index.d.ts +++ b/app/sdks/console-web/types/index.d.ts @@ -85,10 +85,10 @@ declare namespace Appwrite { * * Use this endpoint to allow a new user to register a new account in your * project. After the user registration completes successfully, you can use - * the [/account/verfication](/docs/account#createVerification) route to start - * verifying the user email address. To allow your new user to login to his - * new account, you need to create a new [account - * session](/docs/account#createSession). + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow your new user to login + * to his new account, you need to create a new [account + * session](/docs/client/account#createSession). * * @param {string} email * @param {string} password @@ -191,7 +191,7 @@ declare namespace Appwrite { * When the user clicks the confirmation link he is redirected back to your * app password reset URL with the secret key and email address values * attached to the URL query string. Use the query string params to submit a - * request to the [PUT /account/recovery](/docs/account#updateRecovery) + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) * endpoint to complete the process. * * @param {string} email @@ -207,7 +207,7 @@ declare namespace Appwrite { * Use this endpoint to complete the user account password reset. Both the * **userId** and **secret** arguments will be passed as query parameters to * the redirect URL you have provided when sending your request to the [POST - * /account/recovery](/docs/account#createRecovery) endpoint. + * /account/recovery](/docs/client/account#createRecovery) endpoint. * * Please note that in order to avoid a [Redirect * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) @@ -297,7 +297,7 @@ declare namespace Appwrite { * should redirect the user back for your app and allow you to complete the * verification process by verifying both the **userId** and **secret** * parameters. Learn more about how to [complete the verification - * process](/docs/account#updateAccountVerification). + * process](/docs/client/account#updateAccountVerification). * * Please note that in order to avoid a [Redirect * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) @@ -522,7 +522,10 @@ declare namespace Appwrite { /** * Create Document * - * Create a new Document. + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. * * @param {string} collectionId * @param {object} data @@ -1402,10 +1405,14 @@ declare namespace Appwrite { * for this list of resources. * * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType * @throws {Error} * @return {Promise} */ - getMemberships(teamId: string): Promise; + getMemberships(teamId: string, search: string, limit: number, offset: number, orderType: string): Promise; /** * Create Team Membership @@ -1416,8 +1423,8 @@ declare namespace Appwrite { * * Use the 'URL' parameter to redirect the user from the invitation email back * to your app. When the user is redirected, use the [Update Team Membership - * Status](/docs/teams#updateMembershipStatus) endpoint to allow the user to - * accept the invitation to the team. + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. * * Please note that in order to avoid a [Redirect * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) diff --git a/app/views/console/account/index.phtml b/app/views/console/account/index.phtml index 8843636ea3..0e32243377 100644 --- a/app/views/console/account/index.phtml +++ b/app/views/console/account/index.phtml @@ -24,13 +24,13 @@
User Avatar -
+ - Upload + -
+ - (via gravatar.com ) +
@@ -57,7 +57,7 @@
- +
@@ -85,7 +85,7 @@
-