Skip to content

Commit

Permalink
Merge pull request #29 from appwrite/dev
Browse files Browse the repository at this point in the history
feat: add update teams sensitive attributes
  • Loading branch information
christyjacob4 authored Nov 6, 2024
2 parents 5b5a0ae + f229b05 commit 3222d4e
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console";
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:

```html
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@1.4.1"></script>
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@1.4.2"></script>
```


Expand Down
2 changes: 1 addition & 1 deletion docs/examples/databases/update-string-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const result = await databases.updateStringAttribute(
'', // key
false, // required
'<DEFAULT>', // default
null, // size (optional)
1, // size (optional)
'' // newKey (optional)
);

Expand Down
14 changes: 14 additions & 0 deletions docs/examples/projects/update-teams-sensitive-attributes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Client, Projects } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const projects = new Projects(client);

const result = await projects.updateTeamsSensitiveAttributes(
'<PROJECT_ID>', // projectId
false // enabled
);

console.log(result);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@appwrite.io/console",
"homepage": "https://appwrite.io/support",
"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",
"version": "1.4.1",
"version": "1.4.2",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class Client {
'x-sdk-name': 'Console',
'x-sdk-platform': 'console',
'x-sdk-language': 'web',
'x-sdk-version': '1.4.1',
'x-sdk-version': '1.4.2',
'X-Appwrite-Response-Format': '1.6.0',
};

Expand Down
1 change: 1 addition & 0 deletions src/enums/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ export enum Runtime {
Bun10 = 'bun-1.0',
Bun11 = 'bun-1.1',
Go123 = 'go-1.23',
Static1 = 'static-1',
}
20 changes: 16 additions & 4 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1848,11 +1848,11 @@ export namespace Models {
*/
userId: string;
/**
* User name.
* User name. Hide this attribute by disabling teams sensitive data in the Console.
*/
userName: string;
/**
* User email address.
* User email address. Hide this attribute by disabling teams sensitive data in the Console.
*/
userEmail: string;
/**
Expand All @@ -1876,7 +1876,7 @@ export namespace Models {
*/
confirm: boolean;
/**
* Multi factor authentication status, true if the user has MFA enabled or false otherwise.
* 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.
*/
mfa: boolean;
/**
Expand Down Expand Up @@ -2549,6 +2549,10 @@ export namespace Models {
* Whether or not to send session alert emails to users.
*/
authSessionAlerts: boolean;
/**
* Whether or not to show sensitive attributes in the teams API.
*/
teamsSensitiveAttributes: boolean;
/**
* List of Auth Providers.
*/
Expand Down Expand Up @@ -3979,6 +3983,10 @@ export namespace Models {
* The target identifier.
*/
identifier: string;
/**
* Is the target expired.
*/
expired: boolean;
}
/**
* Migration
Expand Down Expand Up @@ -4009,7 +4017,11 @@ export namespace Models {
*/
source: string;
/**
* Resources to migration.
* A string containing the type of destination of the migration.
*/
destination: string;
/**
* Resources to migrate.
*/
resources: string[];
/**
Expand Down
35 changes: 35 additions & 0 deletions src/services/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,41 @@ export class Projects {
}


return await this.client.call(
'patch',
uri,
apiHeaders,
payload
);
}
/**
* Update project team sensitive attributes
*
*
* @param {string} projectId
* @param {boolean} enabled
* @throws {AppwriteException}
* @returns {Promise<Models.Project>}
*/
async updateTeamsSensitiveAttributes(projectId: string, enabled: boolean): Promise<Models.Project> {
if (typeof projectId === 'undefined') {
throw new AppwriteException('Missing required parameter: "projectId"');
}
if (typeof enabled === 'undefined') {
throw new AppwriteException('Missing required parameter: "enabled"');
}
const apiPath = '/projects/{projectId}/auth/teams-sensitive-attributes'.replace('{projectId}', projectId);
const payload: Payload = {};
if (typeof enabled !== 'undefined') {
payload['enabled'] = enabled;
}
const uri = new URL(this.client.config.endpoint + apiPath);

const apiHeaders: { [header: string]: string } = {
'content-type': 'application/json',
}


return await this.client.call(
'patch',
uri,
Expand Down
4 changes: 2 additions & 2 deletions src/services/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export class Teams {
/**
* List team memberships
*
* 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.
* 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.
*
* @param {string} teamId
* @param {string[]} queries
Expand Down Expand Up @@ -315,7 +315,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee
/**
* Get team membership
*
* Get a team member by the membership unique id. All team members have read access for this resource.
* 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.
*
* @param {string} teamId
* @param {string} membershipId
Expand Down

0 comments on commit 3222d4e

Please sign in to comment.