@open-xchange/soap-client 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/services/sharedAccount.js +18 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-xchange/soap-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "SOAP client for OX App Suite",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"license": "AGPL-3.0-or-later",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"commander": "^14.0.3",
|
|
24
|
-
"p-retry": "^
|
|
24
|
+
"p-retry": "^8.0.0",
|
|
25
25
|
"soap": "^1.8.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -47,23 +47,24 @@ export async function create (context, sharedAccountData) {
|
|
|
47
47
|
*
|
|
48
48
|
* @param {Object} context - The context of the users and groups
|
|
49
49
|
* @param {Object} sharedAccountContext - The context of the shared account
|
|
50
|
-
* @param {
|
|
51
|
-
* @param {Object}
|
|
52
|
-
* @param {Object} calendarConfig - The calendar configuration (permissionLevel, grantedCapability, deniedCapability)
|
|
53
|
-
* @param {Object[]} users - The users to be added to the shared account
|
|
54
|
-
* @param {Object[]} groups - The groups to be added to the shared account
|
|
50
|
+
* @param {number} sharedAccountId - ID of the shared account
|
|
51
|
+
* @param {Object} permissions - The users, groups, capabilities, and module-specific permissions.
|
|
55
52
|
* @returns {Promise<Object>} The shared account object
|
|
56
53
|
* @throws {Error} If the creation of the shared account permissions fails
|
|
57
54
|
*/
|
|
58
|
-
export async function createSharedAccountPermissions (context, sharedAccountContext,
|
|
55
|
+
export async function createSharedAccountPermissions (context, sharedAccountContext, sharedAccountId, permissions) {
|
|
59
56
|
return (await getClient()).createSharedAccountPermissionsAsync({
|
|
60
57
|
ctx: { id: context.id },
|
|
61
|
-
groups,
|
|
62
|
-
users: users.map(user => { return { id: user.userdata.id } }),
|
|
63
|
-
mailConfig,
|
|
64
|
-
calendarConfig,
|
|
65
58
|
sharedAccountCtx: { id: sharedAccountContext.id },
|
|
66
|
-
sharedAccount: { id:
|
|
59
|
+
sharedAccount: { id: sharedAccountId },
|
|
60
|
+
groups: permissions.groups ?? [],
|
|
61
|
+
users: permissions.users?.map(user => ({ id: user.userdata.id })) ?? [],
|
|
62
|
+
capabilities: {
|
|
63
|
+
grantedCapability: permissions.capabilities?.grantedCapability ?? [],
|
|
64
|
+
deniedCapability: permissions.capabilities?.deniedCapability ?? [],
|
|
65
|
+
},
|
|
66
|
+
mailConfig: permissions.mailConfig,
|
|
67
|
+
calendarConfig: permissions.calendarConfig,
|
|
67
68
|
auth: context.admin
|
|
68
69
|
})
|
|
69
70
|
}
|
|
@@ -87,13 +88,13 @@ export async function list (context, pattern = '*') {
|
|
|
87
88
|
* Get all data of a specified shared account in the specified context
|
|
88
89
|
*
|
|
89
90
|
* @param {*} context - The context where the shared account exists
|
|
90
|
-
* @param {
|
|
91
|
+
* @param {number} sharedAccountId - ID of the requested shared account
|
|
91
92
|
* @returns {Promise<Object>} The shared account object
|
|
92
93
|
*/
|
|
93
|
-
export async function getData (context,
|
|
94
|
+
export async function getData (context, sharedAccountId) {
|
|
94
95
|
return (await getClient()).getDataAsync({
|
|
95
96
|
ctx: { id: context.id },
|
|
96
|
-
sharedAccount: { id:
|
|
97
|
+
sharedAccount: { id: sharedAccountId },
|
|
97
98
|
auth: context.admin
|
|
98
99
|
})
|
|
99
100
|
}
|
|
@@ -102,13 +103,13 @@ export async function getData (context, sharedAccountData) {
|
|
|
102
103
|
* Remove a specified shared account in the specified context
|
|
103
104
|
*
|
|
104
105
|
* @param {*} context - The context object where the account will be removed
|
|
105
|
-
* @param {
|
|
106
|
+
* @param {number} sharedAccountId - ID of the shared account to be removed
|
|
106
107
|
* @returns {Promise<void>}
|
|
107
108
|
*/
|
|
108
|
-
export async function remove (context,
|
|
109
|
+
export async function remove (context, sharedAccountId) {
|
|
109
110
|
return (await getClient()).deleteAsync({
|
|
110
111
|
ctx: { id: context.id },
|
|
111
|
-
sharedAccount: { id:
|
|
112
|
+
sharedAccount: { id: sharedAccountId },
|
|
112
113
|
auth: context.admin
|
|
113
114
|
})
|
|
114
115
|
}
|