Skip to content

Commit b29eeef

Browse files
Merge pull request #30 from appwrite/dev
feat: membership privacy
2 parents 3222d4e + 67cabaa commit b29eeef

File tree

9 files changed

+71
-74
lines changed

9 files changed

+71
-74
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console";
3333
To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:
3434

3535
```html
36-
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/[email protected].2"></script>
36+
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/[email protected].3"></script>
3737
```
3838

3939

docs/examples/account/list-credits.md

-14
This file was deleted.

docs/examples/console/get-copon.md

-13
This file was deleted.

docs/examples/projects/update-teams-sensitive-attributes.md docs/examples/projects/update-memberships-privacy.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ const client = new Client()
66

77
const projects = new Projects(client);
88

9-
const result = await projects.updateTeamsSensitiveAttributes(
9+
const result = await projects.updateMembershipsPrivacy(
1010
'<PROJECT_ID>', // projectId
11-
false // enabled
11+
false, // userName
12+
false, // userEmail
13+
false // mfa
1214
);
1315

1416
console.log(result);

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@appwrite.io/console",
33
"homepage": "https://appwrite.io/support",
44
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5-
"version": "1.4.2",
5+
"version": "1.4.3",
66
"license": "BSD-3-Clause",
77
"main": "dist/cjs/sdk.js",
88
"exports": {

src/client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class Client {
304304
'x-sdk-name': 'Console',
305305
'x-sdk-platform': 'console',
306306
'x-sdk-language': 'web',
307-
'x-sdk-version': '1.4.2',
307+
'x-sdk-version': '1.4.3',
308308
'X-Appwrite-Response-Format': '1.6.0',
309309
};
310310

src/models.ts

+13-5
Original file line numberDiff line numberDiff line change
@@ -1848,11 +1848,11 @@ export namespace Models {
18481848
*/
18491849
userId: string;
18501850
/**
1851-
* User name. Hide this attribute by disabling teams sensitive data in the Console.
1851+
* User name. Hide this attribute by toggling membership privacy in the Console.
18521852
*/
18531853
userName: string;
18541854
/**
1855-
* User email address. Hide this attribute by disabling teams sensitive data in the Console.
1855+
* User email address. Hide this attribute by toggling membership privacy in the Console.
18561856
*/
18571857
userEmail: string;
18581858
/**
@@ -1876,7 +1876,7 @@ export namespace Models {
18761876
*/
18771877
confirm: boolean;
18781878
/**
1879-
* Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by disabling teams sensitive data in the Console.
1879+
* Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console.
18801880
*/
18811881
mfa: boolean;
18821882
/**
@@ -2550,9 +2550,17 @@ export namespace Models {
25502550
*/
25512551
authSessionAlerts: boolean;
25522552
/**
2553-
* Whether or not to show sensitive attributes in the teams API.
2553+
* Whether or not to show user names in the teams membership response.
25542554
*/
2555-
teamsSensitiveAttributes: boolean;
2555+
membershipsUserName: boolean;
2556+
/**
2557+
* Whether or not to show user emails in the teams membership response.
2558+
*/
2559+
membershipsUserEmail: boolean;
2560+
/**
2561+
* Whether or not to show user MFA status in the teams membership response.
2562+
*/
2563+
membershipsMfa: boolean;
25562564
/**
25572565
* List of Auth Providers.
25582566
*/

src/services/projects.ts

+49-35
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,55 @@ export class Projects {
439439
}
440440

441441

442+
return await this.client.call(
443+
'patch',
444+
uri,
445+
apiHeaders,
446+
payload
447+
);
448+
}
449+
/**
450+
* Update project team memberships privacy attributes
451+
*
452+
*
453+
* @param {string} projectId
454+
* @param {boolean} userName
455+
* @param {boolean} userEmail
456+
* @param {boolean} mfa
457+
* @throws {AppwriteException}
458+
* @returns {Promise<Models.Project>}
459+
*/
460+
async updateMembershipsPrivacy(projectId: string, userName: boolean, userEmail: boolean, mfa: boolean): Promise<Models.Project> {
461+
if (typeof projectId === 'undefined') {
462+
throw new AppwriteException('Missing required parameter: "projectId"');
463+
}
464+
if (typeof userName === 'undefined') {
465+
throw new AppwriteException('Missing required parameter: "userName"');
466+
}
467+
if (typeof userEmail === 'undefined') {
468+
throw new AppwriteException('Missing required parameter: "userEmail"');
469+
}
470+
if (typeof mfa === 'undefined') {
471+
throw new AppwriteException('Missing required parameter: "mfa"');
472+
}
473+
const apiPath = '/projects/{projectId}/auth/memberships-privacy'.replace('{projectId}', projectId);
474+
const payload: Payload = {};
475+
if (typeof userName !== 'undefined') {
476+
payload['userName'] = userName;
477+
}
478+
if (typeof userEmail !== 'undefined') {
479+
payload['userEmail'] = userEmail;
480+
}
481+
if (typeof mfa !== 'undefined') {
482+
payload['mfa'] = mfa;
483+
}
484+
const uri = new URL(this.client.config.endpoint + apiPath);
485+
486+
const apiHeaders: { [header: string]: string } = {
487+
'content-type': 'application/json',
488+
}
489+
490+
442491
return await this.client.call(
443492
'patch',
444493
uri,
@@ -614,41 +663,6 @@ export class Projects {
614663
}
615664

616665

617-
return await this.client.call(
618-
'patch',
619-
uri,
620-
apiHeaders,
621-
payload
622-
);
623-
}
624-
/**
625-
* Update project team sensitive attributes
626-
*
627-
*
628-
* @param {string} projectId
629-
* @param {boolean} enabled
630-
* @throws {AppwriteException}
631-
* @returns {Promise<Models.Project>}
632-
*/
633-
async updateTeamsSensitiveAttributes(projectId: string, enabled: boolean): Promise<Models.Project> {
634-
if (typeof projectId === 'undefined') {
635-
throw new AppwriteException('Missing required parameter: "projectId"');
636-
}
637-
if (typeof enabled === 'undefined') {
638-
throw new AppwriteException('Missing required parameter: "enabled"');
639-
}
640-
const apiPath = '/projects/{projectId}/auth/teams-sensitive-attributes'.replace('{projectId}', projectId);
641-
const payload: Payload = {};
642-
if (typeof enabled !== 'undefined') {
643-
payload['enabled'] = enabled;
644-
}
645-
const uri = new URL(this.client.config.endpoint + apiPath);
646-
647-
const apiHeaders: { [header: string]: string } = {
648-
'content-type': 'application/json',
649-
}
650-
651-
652666
return await this.client.call(
653667
'patch',
654668
uri,

src/services/teams.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export class Teams {
215215
/**
216216
* List team memberships
217217
*
218-
* Use this endpoint to list a team&#039;s members using the team&#039;s ID. All team members have read access to this endpoint. Hide sensitive attributes (userName, userEmail and mfa) from the response by disabling teams sensitive data in the Console.
218+
* Use this endpoint to list a team&#039;s members using the team&#039;s ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.
219219
*
220220
* @param {string} teamId
221221
* @param {string[]} queries
@@ -315,7 +315,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee
315315
/**
316316
* Get team membership
317317
*
318-
* Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes (userName, userEmail and mfa) from the response by disabling teams sensitive data in the Console.
318+
* Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console.
319319
*
320320
* @param {string} teamId
321321
* @param {string} membershipId

0 commit comments

Comments
 (0)