From 5b6da0e8598d0fdf2e8f4cbdb1b003ed89c25c88 Mon Sep 17 00:00:00 2001
From: loks0n <22452787+loks0n@users.noreply.github.com>
Date: Wed, 6 Nov 2024 18:15:35 +0100
Subject: [PATCH 1/2] feat: teams sensistive data
---
README.md | 2 +-
.../databases/update-string-attribute.md | 2 +-
.../update-teams-sensitive-attributes.md | 14 ++++++++
package.json | 2 +-
src/client.ts | 6 +++-
src/enums/runtime.ts | 1 +
src/models.ts | 22 +++++++++---
src/services/projects.ts | 35 +++++++++++++++++++
src/services/teams.ts | 4 +--
9 files changed, 77 insertions(+), 11 deletions(-)
create mode 100644 docs/examples/projects/update-teams-sensitive-attributes.md
diff --git a/README.md b/README.md
index 3c1d43f..0c4bb75 100644
--- a/README.md
+++ b/README.md
@@ -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
tag, but before you use any Appwrite services:
```html
-
+
```
diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md
index 0ac1497..f652c30 100644
--- a/docs/examples/databases/update-string-attribute.md
+++ b/docs/examples/databases/update-string-attribute.md
@@ -12,7 +12,7 @@ const result = await databases.updateStringAttribute(
'', // key
false, // required
'', // default
- null, // size (optional)
+ 1, // size (optional)
'' // newKey (optional)
);
diff --git a/docs/examples/projects/update-teams-sensitive-attributes.md b/docs/examples/projects/update-teams-sensitive-attributes.md
new file mode 100644
index 0000000..fd327e7
--- /dev/null
+++ b/docs/examples/projects/update-teams-sensitive-attributes.md
@@ -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
+
+const projects = new Projects(client);
+
+const result = await projects.updateTeamsSensitiveAttributes(
+ '', // projectId
+ false // enabled
+);
+
+console.log(result);
diff --git a/package.json b/package.json
index 01aa4a0..9537bda 100644
--- a/package.json
+++ b/package.json
@@ -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.2.2",
+ "version": "1.2.1",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
diff --git a/src/client.ts b/src/client.ts
index 05a6aca..a5ce630 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -304,7 +304,7 @@ class Client {
'x-sdk-name': 'Console',
'x-sdk-platform': 'console',
'x-sdk-language': 'web',
- 'x-sdk-version': '1.2.2',
+ 'x-sdk-version': '1.2.1',
'X-Appwrite-Response-Format': '1.6.0',
};
@@ -682,6 +682,10 @@ class Client {
return response;
}
+ async ping(): Promise {
+ return this.call('GET', new URL(this.config.endpoint + '/ping'));
+ }
+
async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise {
const { uri, options } = this.prepareRequest(method, url, headers, params);
diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts
index f000c00..3e7d7a4 100644
--- a/src/enums/runtime.ts
+++ b/src/enums/runtime.ts
@@ -56,4 +56,5 @@ export enum Runtime {
Bun10 = 'bun-1.0',
Bun11 = 'bun-1.1',
Go123 = 'go-1.23',
+ Static1 = 'static-1',
}
\ No newline at end of file
diff --git a/src/models.ts b/src/models.ts
index 46bb345..bb6efe3 100644
--- a/src/models.ts
+++ b/src/models.ts
@@ -1840,11 +1840,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;
/**
@@ -1868,7 +1868,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;
/**
@@ -2541,6 +2541,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.
*/
@@ -3967,6 +3971,10 @@ export namespace Models {
* The target identifier.
*/
identifier: string;
+ /**
+ * Is the target expired.
+ */
+ expired: boolean;
}
/**
* Migration
@@ -3977,7 +3985,7 @@ export namespace Models {
*/
$id: string;
/**
- * Variable creation date in ISO 8601 format.
+ * Migration creation date in ISO 8601 format.
*/
$createdAt: string;
/**
@@ -3997,7 +4005,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[];
/**
diff --git a/src/services/projects.ts b/src/services/projects.ts
index c1de5a4..ded90c6 100644
--- a/src/services/projects.ts
+++ b/src/services/projects.ts
@@ -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}
+ */
+ async updateTeamsSensitiveAttributes(projectId: string, enabled: boolean): Promise {
+ 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,
diff --git a/src/services/teams.ts b/src/services/teams.ts
index 91a6db7..32db135 100644
--- a/src/services/teams.ts
+++ b/src/services/teams.ts
@@ -215,7 +215,7 @@ export class Teams {
/**
* List team memberships
*
- * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.
+ * Use this endpoint to list a team's members using the team'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
@@ -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
From 5bf940719ca240f5d7e7dd9686f75b8749734705 Mon Sep 17 00:00:00 2001
From: loks0n <22452787+loks0n@users.noreply.github.com>
Date: Wed, 6 Nov 2024 18:18:15 +0100
Subject: [PATCH 2/2] feat: update teams sensitive attributes
---
README.md | 2 +-
package.json | 2 +-
src/client.ts | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 0c4bb75..0fce1d0 100644
--- a/README.md
+++ b/README.md
@@ -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 tag, but before you use any Appwrite services:
```html
-
+
```
diff --git a/package.json b/package.json
index 9537bda..5099b26 100644
--- a/package.json
+++ b/package.json
@@ -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.2.1",
+ "version": "1.2.3",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
diff --git a/src/client.ts b/src/client.ts
index a5ce630..2ae904e 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -304,7 +304,7 @@ class Client {
'x-sdk-name': 'Console',
'x-sdk-platform': 'console',
'x-sdk-language': 'web',
- 'x-sdk-version': '1.2.1',
+ 'x-sdk-version': '1.2.3',
'X-Appwrite-Response-Format': '1.6.0',
};