@open-xchange/soap-client 0.1.0 → 0.1.2
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/CHANGELOG.md +6 -0
- package/package.json +2 -2
- package/services/sharedAccount.js +36 -17
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.1.2] - 2026-04-21
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `convertUserToSharedAccount` to convert an existing user to a shared account
|
|
12
|
+
|
|
7
13
|
## [0.1.0] - 2026-03-15
|
|
8
14
|
|
|
9
15
|
### Changed
|
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.2",
|
|
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": {
|
|
@@ -42,28 +42,47 @@ export async function create (context, sharedAccountData) {
|
|
|
42
42
|
})
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Converts an existing user to a shared account using the OX Shared Account Service
|
|
47
|
+
*
|
|
48
|
+
* @param {Object} context - The context of the user to be converted
|
|
49
|
+
* @param {number} userId - ID of the user to be converted
|
|
50
|
+
* @param {string} password - The password for the new shared account
|
|
51
|
+
* @returns {Promise<void>}
|
|
52
|
+
* @throws {Error} If the conversion fails
|
|
53
|
+
*/
|
|
54
|
+
export async function convertUserToSharedAccount (context, userId, password) {
|
|
55
|
+
return (await getClient()).convertUserToSharedAccountAsync({
|
|
56
|
+
ctx: { id: context.id },
|
|
57
|
+
user: { id: userId },
|
|
58
|
+
password,
|
|
59
|
+
auth: context.auth
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
|
|
45
63
|
/**
|
|
46
64
|
* Add users and groups with specified permissions and capabilities to an existing shared account using the OX Shared Account Service.
|
|
47
65
|
*
|
|
48
66
|
* @param {Object} context - The context of the users and groups
|
|
49
67
|
* @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
|
|
68
|
+
* @param {number} sharedAccountId - ID of the shared account
|
|
69
|
+
* @param {Object} permissions - The users, groups, capabilities, and module-specific permissions.
|
|
55
70
|
* @returns {Promise<Object>} The shared account object
|
|
56
71
|
* @throws {Error} If the creation of the shared account permissions fails
|
|
57
72
|
*/
|
|
58
|
-
export async function createSharedAccountPermissions (context, sharedAccountContext,
|
|
73
|
+
export async function createSharedAccountPermissions (context, sharedAccountContext, sharedAccountId, permissions) {
|
|
59
74
|
return (await getClient()).createSharedAccountPermissionsAsync({
|
|
60
75
|
ctx: { id: context.id },
|
|
61
|
-
groups,
|
|
62
|
-
users: users.map(user => { return { id: user.userdata.id } }),
|
|
63
|
-
mailConfig,
|
|
64
|
-
calendarConfig,
|
|
65
76
|
sharedAccountCtx: { id: sharedAccountContext.id },
|
|
66
|
-
sharedAccount: { id:
|
|
77
|
+
sharedAccount: { id: sharedAccountId },
|
|
78
|
+
groups: permissions.groups ?? [],
|
|
79
|
+
users: permissions.users?.map(user => ({ id: user.userdata.id })) ?? [],
|
|
80
|
+
capabilities: {
|
|
81
|
+
grantedCapability: permissions.capabilities?.grantedCapability ?? [],
|
|
82
|
+
deniedCapability: permissions.capabilities?.deniedCapability ?? [],
|
|
83
|
+
},
|
|
84
|
+
mailConfig: permissions.mailConfig,
|
|
85
|
+
calendarConfig: permissions.calendarConfig,
|
|
67
86
|
auth: context.admin
|
|
68
87
|
})
|
|
69
88
|
}
|
|
@@ -87,13 +106,13 @@ export async function list (context, pattern = '*') {
|
|
|
87
106
|
* Get all data of a specified shared account in the specified context
|
|
88
107
|
*
|
|
89
108
|
* @param {*} context - The context where the shared account exists
|
|
90
|
-
* @param {
|
|
109
|
+
* @param {number} sharedAccountId - ID of the requested shared account
|
|
91
110
|
* @returns {Promise<Object>} The shared account object
|
|
92
111
|
*/
|
|
93
|
-
export async function getData (context,
|
|
112
|
+
export async function getData (context, sharedAccountId) {
|
|
94
113
|
return (await getClient()).getDataAsync({
|
|
95
114
|
ctx: { id: context.id },
|
|
96
|
-
sharedAccount: { id:
|
|
115
|
+
sharedAccount: { id: sharedAccountId },
|
|
97
116
|
auth: context.admin
|
|
98
117
|
})
|
|
99
118
|
}
|
|
@@ -102,13 +121,13 @@ export async function getData (context, sharedAccountData) {
|
|
|
102
121
|
* Remove a specified shared account in the specified context
|
|
103
122
|
*
|
|
104
123
|
* @param {*} context - The context object where the account will be removed
|
|
105
|
-
* @param {
|
|
124
|
+
* @param {number} sharedAccountId - ID of the shared account to be removed
|
|
106
125
|
* @returns {Promise<void>}
|
|
107
126
|
*/
|
|
108
|
-
export async function remove (context,
|
|
127
|
+
export async function remove (context, sharedAccountId) {
|
|
109
128
|
return (await getClient()).deleteAsync({
|
|
110
129
|
ctx: { id: context.id },
|
|
111
|
-
sharedAccount: { id:
|
|
130
|
+
sharedAccount: { id: sharedAccountId },
|
|
112
131
|
auth: context.admin
|
|
113
132
|
})
|
|
114
133
|
}
|