@open-xchange/soap-client 0.0.11 → 0.1.0
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 +84 -0
- package/bin/provision.js +3 -2
- package/package.json +4 -5
- package/services/common/context.js +15 -11
- package/services/common/user.js +15 -11
- package/services/reseller/oxaas.js +7 -3
- package/services/reseller/resellerContext.js +12 -8
- package/services/reseller/resellerUser.js +13 -9
- package/services/secondaryAccount.js +9 -5
- package/services/sharedAccount.js +10 -6
- package/soap.js +3 -2
- package/.env.default +0 -18
- package/example-provisioning.json +0 -55
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-03-15
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Replace chalk and dotenv with Node.js built-ins
|
|
12
|
+
- Clean up dependencies, packaging, and config files
|
|
13
|
+
|
|
14
|
+
## [0.0.12] - 2026-02-25
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Lazy-init SOAP clients to avoid WSDL fetches at import time
|
|
19
|
+
|
|
20
|
+
## [0.0.11] - 2026-02-24
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Support for shared accounts in e2e tests
|
|
25
|
+
|
|
26
|
+
## [0.0.10] - 2026-01-22
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Exponential backoff with jitter to SOAP client retries
|
|
31
|
+
|
|
32
|
+
## [0.0.9] - 2025-12-12
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- Update dependencies
|
|
37
|
+
|
|
38
|
+
## [0.0.8] - 2025-09-30
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- Unhandled rejection timeout errors in soap-client
|
|
43
|
+
|
|
44
|
+
## [0.0.7] - 2025-09-12
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- Set access combination when provisioning
|
|
49
|
+
|
|
50
|
+
## [0.0.6] - 2025-09-02
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- Correctly identify already existing users when provisioning
|
|
55
|
+
|
|
56
|
+
## [0.0.5] - 2025-08-18
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
60
|
+
- Update provisioning script
|
|
61
|
+
|
|
62
|
+
## [0.0.4] - 2025-07-28
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
- Increase SOAP client timeout
|
|
67
|
+
|
|
68
|
+
## [0.0.3] - 2025-07-18
|
|
69
|
+
|
|
70
|
+
### Removed
|
|
71
|
+
|
|
72
|
+
- Secondary account service from reseller
|
|
73
|
+
|
|
74
|
+
## [0.0.2] - 2025-07-18
|
|
75
|
+
|
|
76
|
+
### Changed
|
|
77
|
+
|
|
78
|
+
- Update dependencies
|
|
79
|
+
|
|
80
|
+
## [0.0.1] - 2025-02-28
|
|
81
|
+
|
|
82
|
+
### Added
|
|
83
|
+
|
|
84
|
+
- Initial release: extract SOAP client into its own library
|
package/bin/provision.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import fs from 'node:fs'
|
|
3
3
|
import { program } from 'commander'
|
|
4
|
-
import dotenv from 'dotenv'
|
|
5
4
|
import * as secondaryAccountService from '../services/secondaryAccount.js'
|
|
6
5
|
import * as userService from '../services/common/user.js'
|
|
7
6
|
import * as contextService from '../services/common/context.js'
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
for (const envFile of ['.env', '.env.defaults']) {
|
|
9
|
+
try { process.loadEnvFile(envFile) } catch {}
|
|
10
|
+
}
|
|
10
11
|
|
|
11
12
|
const contextAdmin = {
|
|
12
13
|
admin: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-xchange/soap-client",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "SOAP client for OX App Suite",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,13 +20,12 @@
|
|
|
20
20
|
"author": "",
|
|
21
21
|
"license": "AGPL-3.0-or-later",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"commander": "^14.0.
|
|
24
|
-
"dotenv": "^17.2.3",
|
|
23
|
+
"commander": "^14.0.3",
|
|
25
24
|
"p-retry": "^7.1.1",
|
|
26
|
-
"soap": "^1.
|
|
25
|
+
"soap": "^1.8.0"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
|
-
"@open-xchange/lint": "0.
|
|
28
|
+
"@open-xchange/lint": "0.3.0"
|
|
30
29
|
},
|
|
31
30
|
"scripts": {
|
|
32
31
|
"lint": "eslint .",
|
|
@@ -20,14 +20,18 @@
|
|
|
20
20
|
|
|
21
21
|
import { createClientAsync, logSoapError } from '../../soap.js'
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
let OXContextService
|
|
24
|
+
function getClient () {
|
|
25
|
+
if (!OXContextService) OXContextService = createClientAsync('OXContextService')
|
|
26
|
+
return OXContextService
|
|
27
|
+
}
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
30
|
* This function retrieves the default context from the OXContextService.
|
|
27
31
|
* @returns {Promise<Object>} The first result from the listAsync method call.
|
|
28
32
|
*/
|
|
29
33
|
export async function getDefault () {
|
|
30
|
-
return (await
|
|
34
|
+
return (await getClient()).listAsync({ search_pattern: 'defaultcontext' })[0]
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
/**
|
|
@@ -36,7 +40,7 @@ export async function getDefault () {
|
|
|
36
40
|
* @param {number} id The ID of the context to remove.
|
|
37
41
|
*/
|
|
38
42
|
export async function remove (id) {
|
|
39
|
-
return (await
|
|
43
|
+
return (await getClient()).deleteAsync({ ctx: { id } })
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
/**
|
|
@@ -59,7 +63,7 @@ export async function remove (id) {
|
|
|
59
63
|
* @returns {Promise<Object>} The created context.
|
|
60
64
|
*/
|
|
61
65
|
export async function create (ctx = {}, adminUser = {}, accessCombinationName = 'all') {
|
|
62
|
-
return (await
|
|
66
|
+
return (await getClient())
|
|
63
67
|
.createAsync({
|
|
64
68
|
ctx,
|
|
65
69
|
admin_user: Object.assign({
|
|
@@ -91,7 +95,7 @@ export async function create (ctx = {}, adminUser = {}, accessCombinationName =
|
|
|
91
95
|
// eslint-disable-next-line camelcase
|
|
92
96
|
export async function changeModuleAccessByName (id, access_combination_name) {
|
|
93
97
|
// eslint-disable-next-line camelcase
|
|
94
|
-
return (await
|
|
98
|
+
return (await getClient()).changeModuleAccessByNameAsync({ ctx: { id }, access_combination_name })
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
/**
|
|
@@ -105,7 +109,7 @@ export async function changeCapabilities (id, capsToAdd, capsToRemove) {
|
|
|
105
109
|
const data = {}
|
|
106
110
|
if (capsToAdd) data.capsToAdd = capsToAdd
|
|
107
111
|
if (capsToRemove) data.capsToRemove = capsToRemove
|
|
108
|
-
return (await
|
|
112
|
+
return (await getClient()).changeCapabilitiesAsync({ ctx: { id }, ...data })
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
/**
|
|
@@ -114,7 +118,7 @@ export async function changeCapabilities (id, capsToAdd, capsToRemove) {
|
|
|
114
118
|
* @returns {Promise<Object>} The module access of the specified context.
|
|
115
119
|
*/
|
|
116
120
|
export async function getModuleAccess (id) {
|
|
117
|
-
return (await
|
|
121
|
+
return (await getClient()).getModuleAccessAsync({ ctx: { id } })
|
|
118
122
|
}
|
|
119
123
|
/**
|
|
120
124
|
* This function changes the module access of the specified context.
|
|
@@ -124,7 +128,7 @@ export async function getModuleAccess (id) {
|
|
|
124
128
|
*/
|
|
125
129
|
export async function changeModuleAccess (id, moduleAccess) {
|
|
126
130
|
const currentAccess = await getModuleAccess(id)
|
|
127
|
-
return (await
|
|
131
|
+
return (await getClient()).changeModuleAccessAsync({ ctx: { id }, access: { ...currentAccess, ...moduleAccess } })
|
|
128
132
|
}
|
|
129
133
|
|
|
130
134
|
/**
|
|
@@ -135,7 +139,7 @@ export async function changeModuleAccess (id, moduleAccess) {
|
|
|
135
139
|
* @returns {Promise<Array<Object>>} The list of contexts that match the search pattern.
|
|
136
140
|
*/
|
|
137
141
|
export async function list (searchPattern, { excludeDisabled } = { excludeDisabled: true }) {
|
|
138
|
-
return (await
|
|
142
|
+
return (await getClient()).listAsync({ search_pattern: searchPattern, exclude_disabled: excludeDisabled }).catch(e => {
|
|
139
143
|
logSoapError(e)
|
|
140
144
|
return []
|
|
141
145
|
})
|
|
@@ -147,7 +151,7 @@ export async function list (searchPattern, { excludeDisabled } = { excludeDisabl
|
|
|
147
151
|
* @returns {Promise<Object>} The context with the specified ID.
|
|
148
152
|
*/
|
|
149
153
|
export async function get (id) {
|
|
150
|
-
return (await
|
|
154
|
+
return (await getClient()).getDataAsync({ ctx: { id } })
|
|
151
155
|
}
|
|
152
156
|
|
|
153
157
|
/**
|
|
@@ -156,5 +160,5 @@ export async function get (id) {
|
|
|
156
160
|
* @returns {Promise<void>}
|
|
157
161
|
*/
|
|
158
162
|
export async function change (ctx) {
|
|
159
|
-
return (await
|
|
163
|
+
return (await getClient()).changeAsync({ ctx })
|
|
160
164
|
}
|
package/services/common/user.js
CHANGED
|
@@ -20,7 +20,11 @@
|
|
|
20
20
|
|
|
21
21
|
import { createClientAsync, logSoapError } from '../../soap.js'
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
let OXUserService
|
|
24
|
+
function getClient () {
|
|
25
|
+
if (!OXUserService) OXUserService = createClientAsync('OXUserService')
|
|
26
|
+
return OXUserService
|
|
27
|
+
}
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
30
|
* This function removes the user with the specified context and user ID.
|
|
@@ -29,7 +33,7 @@ const OXUserService = createClientAsync('OXUserService')
|
|
|
29
33
|
* @returns {Promise<Boolean>} Returns true if it could remove the user and false if it could not
|
|
30
34
|
*/
|
|
31
35
|
export async function remove (context, userId) {
|
|
32
|
-
return (await
|
|
36
|
+
return (await getClient()).deleteAsync({
|
|
33
37
|
ctx: { id: context.id },
|
|
34
38
|
user: { id: userId },
|
|
35
39
|
auth: context.admin
|
|
@@ -43,7 +47,7 @@ export async function remove (context, userId) {
|
|
|
43
47
|
* @returns {Promise<Object>} The created user.
|
|
44
48
|
*/
|
|
45
49
|
export async function create (context, usrdata) {
|
|
46
|
-
return (await
|
|
50
|
+
return (await getClient()).createAsync({
|
|
47
51
|
ctx: { id: context.id },
|
|
48
52
|
usrdata,
|
|
49
53
|
auth: context.admin
|
|
@@ -57,7 +61,7 @@ export async function create (context, usrdata) {
|
|
|
57
61
|
* @returns {Promise<void>}
|
|
58
62
|
*/
|
|
59
63
|
export async function change (context, usrdata) {
|
|
60
|
-
return (await
|
|
64
|
+
return (await getClient()).changeAsync({
|
|
61
65
|
ctx: { id: context.id },
|
|
62
66
|
usrdata,
|
|
63
67
|
auth: context.admin
|
|
@@ -65,7 +69,7 @@ export async function change (context, usrdata) {
|
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
export async function changeByModuleAccess (context, userId, currentAccess, moduleAccess) {
|
|
68
|
-
return (await
|
|
72
|
+
return (await getClient()).changeByModuleAccessAsync({
|
|
69
73
|
ctx: { id: context.id },
|
|
70
74
|
moduleAccess: Object.assign({}, currentAccess, moduleAccess),
|
|
71
75
|
user: { id: userId },
|
|
@@ -74,7 +78,7 @@ export async function changeByModuleAccess (context, userId, currentAccess, modu
|
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
export async function changeByModuleAccessName (context, userId, accessCombinationName) {
|
|
77
|
-
return (await
|
|
81
|
+
return (await getClient()).changeByModuleAccessNameAsync({
|
|
78
82
|
ctx: { id: context.id },
|
|
79
83
|
access_combination_name: accessCombinationName,
|
|
80
84
|
user: { id: userId },
|
|
@@ -83,7 +87,7 @@ export async function changeByModuleAccessName (context, userId, accessCombinati
|
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
export async function getModuleAccess (context, userId) {
|
|
86
|
-
return (await
|
|
90
|
+
return (await getClient()).getModuleAccessAsync({
|
|
87
91
|
ctx: { id: context.id },
|
|
88
92
|
user: { id: userId },
|
|
89
93
|
auth: context.admin
|
|
@@ -100,11 +104,11 @@ export async function changeCapabilities (context, userId, capsToAdd, capsToRemo
|
|
|
100
104
|
}
|
|
101
105
|
if (capsToAdd) data.capsToAdd = capsToAdd
|
|
102
106
|
if (capsToRemove) data.capsToRemove = capsToRemove
|
|
103
|
-
return (await
|
|
107
|
+
return (await getClient()).changeCapabilitiesAsync(data)
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
export async function exists (context, userId) {
|
|
107
|
-
return (await
|
|
111
|
+
return (await getClient()).existsAsync({
|
|
108
112
|
ctx: { id: context.id },
|
|
109
113
|
user: { id: userId },
|
|
110
114
|
auth: context.admin
|
|
@@ -112,7 +116,7 @@ export async function exists (context, userId) {
|
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
export async function list (context, searchPattern, includeGuests = false) {
|
|
115
|
-
return (await
|
|
119
|
+
return (await getClient()).listAsync({
|
|
116
120
|
ctx: { id: context.id },
|
|
117
121
|
search_pattern: searchPattern,
|
|
118
122
|
include_guests: includeGuests,
|
|
@@ -121,7 +125,7 @@ export async function list (context, searchPattern, includeGuests = false) {
|
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
export async function listAll (context, includeGuests = false, excludeUsers = []) {
|
|
124
|
-
return (await
|
|
128
|
+
return (await getClient()).listAsync({
|
|
125
129
|
ctx: { id: context.id },
|
|
126
130
|
include_guests: includeGuests,
|
|
127
131
|
exclude_users: excludeUsers,
|
|
@@ -20,12 +20,16 @@
|
|
|
20
20
|
|
|
21
21
|
import { createClientAsync } from '../../soap.js'
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
let OXaaSService
|
|
24
|
+
function getClient () {
|
|
25
|
+
if (!OXaaSService) OXaaSService = createClientAsync('OXaaSService')
|
|
26
|
+
return OXaaSService
|
|
27
|
+
}
|
|
24
28
|
|
|
25
29
|
export async function setMailQuota (data) {
|
|
26
|
-
return (await
|
|
30
|
+
return (await getClient()).setMailQuotaAsync(data)
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
export async function createSharedDomain (data) {
|
|
30
|
-
return (await
|
|
34
|
+
return (await getClient()).createSharedDomain(data)
|
|
31
35
|
}
|
|
@@ -20,36 +20,40 @@
|
|
|
20
20
|
|
|
21
21
|
import { createClientAsync, logSoapError } from '../../soap.js'
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
let OXResellerContextService
|
|
24
|
+
function getClient () {
|
|
25
|
+
if (!OXResellerContextService) OXResellerContextService = createClientAsync('OXResellerContextService')
|
|
26
|
+
return OXResellerContextService
|
|
27
|
+
}
|
|
24
28
|
|
|
25
29
|
export async function create (data) {
|
|
26
|
-
return (await
|
|
30
|
+
return (await getClient()).createAsync(data)
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
export async function remove (contextId) {
|
|
30
|
-
return (await
|
|
34
|
+
return (await getClient()).deleteAsync({
|
|
31
35
|
ctx: { id: contextId }
|
|
32
36
|
}).catch(logSoapError)
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
export async function change (ctx) {
|
|
36
|
-
return (await
|
|
40
|
+
return (await getClient()).changeAsync({ ctx })
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
export async function get (id) {
|
|
40
|
-
return (await
|
|
44
|
+
return (await getClient()).getDataAsync({ ctx: { id } })
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
export async function getModuleAccess (id) {
|
|
44
|
-
return (await
|
|
48
|
+
return (await getClient()).getModuleAccessAsync({ ctx: id })
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
export async function changeModuleAccess (id, access) {
|
|
48
52
|
const currentAccess = await getModuleAccess(id)
|
|
49
53
|
|
|
50
|
-
return (await
|
|
54
|
+
return (await getClient()).changeModuleAccessAsync({ ctx: { id }, access: { ...currentAccess, ...access } })
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
export async function listAll (data) {
|
|
54
|
-
return (await
|
|
58
|
+
return (await getClient()).listAllAsync(data)
|
|
55
59
|
}
|
|
@@ -20,10 +20,14 @@
|
|
|
20
20
|
|
|
21
21
|
import { createClientAsync, logSoapError } from '../../soap.js'
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
let OXResellerUserService
|
|
24
|
+
function getClient () {
|
|
25
|
+
if (!OXResellerUserService) OXResellerUserService = createClientAsync('OXResellerUserService')
|
|
26
|
+
return OXResellerUserService
|
|
27
|
+
}
|
|
24
28
|
|
|
25
29
|
export async function remove (contextId, userId) {
|
|
26
|
-
return (await
|
|
30
|
+
return (await getClient()).deleteAsync({
|
|
27
31
|
ctx: { id: contextId },
|
|
28
32
|
user: { id: userId }
|
|
29
33
|
}).catch(logSoapError)
|
|
@@ -36,7 +40,7 @@ export async function remove (contextId, userId) {
|
|
|
36
40
|
* @returns {Promise<void>}
|
|
37
41
|
*/
|
|
38
42
|
export async function change (context, usrdata) {
|
|
39
|
-
return (await
|
|
43
|
+
return (await getClient()).changeAsync({
|
|
40
44
|
ctx: { id: context.id },
|
|
41
45
|
usrdata,
|
|
42
46
|
auth: { login: context.admin.name, password: context.admin.password }
|
|
@@ -44,11 +48,11 @@ export async function change (context, usrdata) {
|
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
export async function get (data) {
|
|
47
|
-
return (await
|
|
51
|
+
return (await getClient()).getDataAsync(data)
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
export async function getModuleAccess (context, userId) {
|
|
51
|
-
return (await
|
|
55
|
+
return (await getClient()).getModuleAccessAsync({
|
|
52
56
|
ctx: { id: context.id },
|
|
53
57
|
user: { id: userId },
|
|
54
58
|
auth: { login: context.admin.name, password: context.admin.password }
|
|
@@ -58,7 +62,7 @@ export async function getModuleAccess (context, userId) {
|
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
export async function changeByModuleAccess (context, userId, currentAccess, moduleAccess) {
|
|
61
|
-
return (await
|
|
65
|
+
return (await getClient()).changeByModuleAccessAsync({
|
|
62
66
|
ctx: { id: context.id },
|
|
63
67
|
moduleAccess: Object.assign({}, currentAccess, moduleAccess),
|
|
64
68
|
user: { id: userId },
|
|
@@ -67,7 +71,7 @@ export async function changeByModuleAccess (context, userId, currentAccess, modu
|
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
export async function changeByModuleAccessName (context, userId, accessCombinationName) {
|
|
70
|
-
return (await
|
|
74
|
+
return (await getClient()).changeByModuleAccessNameAsync({
|
|
71
75
|
ctx: { id: context.id },
|
|
72
76
|
access_combination_name: accessCombinationName,
|
|
73
77
|
user: { id: userId },
|
|
@@ -76,7 +80,7 @@ export async function changeByModuleAccessName (context, userId, accessCombinati
|
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
export async function createByModuleAccessName (context, usrdata) {
|
|
79
|
-
return (await
|
|
83
|
+
return (await getClient()).createByModuleAccessNameAsync({
|
|
80
84
|
ctx: { id: context.id },
|
|
81
85
|
usrdata,
|
|
82
86
|
access_combination_name: 'all',
|
|
@@ -85,5 +89,5 @@ export async function createByModuleAccessName (context, usrdata) {
|
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
export async function listAll (data) {
|
|
88
|
-
return await (await
|
|
92
|
+
return await (await getClient()).listAllAsync(data)
|
|
89
93
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { createClientAsync } from '../soap.js'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
let OXSecondaryAccountService
|
|
4
|
+
function getClient () {
|
|
5
|
+
if (!OXSecondaryAccountService) OXSecondaryAccountService = createClientAsync('OXSecondaryAccountService')
|
|
6
|
+
return OXSecondaryAccountService
|
|
7
|
+
}
|
|
4
8
|
|
|
5
9
|
/**
|
|
6
10
|
* Creates a secondary account using the OX Secondary Account Service
|
|
@@ -13,7 +17,7 @@ const OXSecondaryAccountService = createClientAsync('OXSecondaryAccountService')
|
|
|
13
17
|
* @throws {Error} If the account creation fails
|
|
14
18
|
*/
|
|
15
19
|
export async function create (accountData, context, users = [], groups = []) {
|
|
16
|
-
return (await
|
|
20
|
+
return (await getClient()).createAsync({
|
|
17
21
|
accountDataOnCreate: accountData,
|
|
18
22
|
context: { id: context.id },
|
|
19
23
|
users: users || [],
|
|
@@ -22,13 +26,13 @@ export async function create (accountData, context, users = [], groups = []) {
|
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
export async function list (context) {
|
|
25
|
-
return (await
|
|
29
|
+
return (await getClient()).listAsync({
|
|
26
30
|
context: { id: context.id },
|
|
27
31
|
auth: context.admin
|
|
28
32
|
})
|
|
29
33
|
}
|
|
30
34
|
export async function remove (primaryAddress, context, users, groups) {
|
|
31
|
-
return (await
|
|
35
|
+
return (await getClient()).deleteAsync({
|
|
32
36
|
primaryAddress,
|
|
33
37
|
context: { id: context.id },
|
|
34
38
|
users,
|
|
@@ -37,7 +41,7 @@ export async function remove (primaryAddress, context, users, groups) {
|
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
export async function update (primaryAddress, accountData, context, users, groups) {
|
|
40
|
-
return (await
|
|
44
|
+
return (await getClient()).updateAsync({
|
|
41
45
|
primaryAddress,
|
|
42
46
|
accountDataUpdate: accountData,
|
|
43
47
|
context: { id: context.id },
|
|
@@ -20,7 +20,11 @@
|
|
|
20
20
|
|
|
21
21
|
import { createClientAsync } from '../soap.js'
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
let OXSharedAccountService
|
|
24
|
+
function getClient () {
|
|
25
|
+
if (!OXSharedAccountService) OXSharedAccountService = createClientAsync('OXSharedAccountService')
|
|
26
|
+
return OXSharedAccountService
|
|
27
|
+
}
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
30
|
* Creates a shared account using the OX Shared Account Service
|
|
@@ -31,7 +35,7 @@ const OXSharedAccountService = createClientAsync('OXSharedAccountService')
|
|
|
31
35
|
* @throws {Error} If the shared account creation fails
|
|
32
36
|
*/
|
|
33
37
|
export async function create (context, sharedAccountData) {
|
|
34
|
-
return (await
|
|
38
|
+
return (await getClient()).createAsync({
|
|
35
39
|
ctx: { id: context.id },
|
|
36
40
|
sharedAccountData, // display_name, given_name, imapServer, language, mailenabled, name, sur_name, primaryEmail, email1, smtpServer, timezone, password
|
|
37
41
|
auth: context.admin
|
|
@@ -52,7 +56,7 @@ export async function create (context, sharedAccountData) {
|
|
|
52
56
|
* @throws {Error} If the creation of the shared account permissions fails
|
|
53
57
|
*/
|
|
54
58
|
export async function createSharedAccountPermissions (context, sharedAccountContext, sharedAccountData, mailConfig, calendarConfig, users = [], groups = []) {
|
|
55
|
-
return (await
|
|
59
|
+
return (await getClient()).createSharedAccountPermissionsAsync({
|
|
56
60
|
ctx: { id: context.id },
|
|
57
61
|
groups,
|
|
58
62
|
users: users.map(user => { return { id: user.userdata.id } }),
|
|
@@ -72,7 +76,7 @@ export async function createSharedAccountPermissions (context, sharedAccountCont
|
|
|
72
76
|
* @returns {Promise<Object[]>} The list of shared account objects
|
|
73
77
|
*/
|
|
74
78
|
export async function list (context, pattern = '*') {
|
|
75
|
-
return (await
|
|
79
|
+
return (await getClient()).listAsync({
|
|
76
80
|
ctx: { id: context.id },
|
|
77
81
|
search_pattern: pattern,
|
|
78
82
|
auth: context.admin
|
|
@@ -87,7 +91,7 @@ export async function list (context, pattern = '*') {
|
|
|
87
91
|
* @returns {Promise<Object>} The shared account object
|
|
88
92
|
*/
|
|
89
93
|
export async function getData (context, sharedAccountData) {
|
|
90
|
-
return (await
|
|
94
|
+
return (await getClient()).getDataAsync({
|
|
91
95
|
ctx: { id: context.id },
|
|
92
96
|
sharedAccount: { id: sharedAccountData.id },
|
|
93
97
|
auth: context.admin
|
|
@@ -102,7 +106,7 @@ export async function getData (context, sharedAccountData) {
|
|
|
102
106
|
* @returns {Promise<void>}
|
|
103
107
|
*/
|
|
104
108
|
export async function remove (context, sharedAccountData) {
|
|
105
|
-
return (await
|
|
109
|
+
return (await getClient()).deleteAsync({
|
|
106
110
|
ctx: { id: context.id },
|
|
107
111
|
sharedAccount: { id: sharedAccountData.id },
|
|
108
112
|
auth: context.admin
|
package/soap.js
CHANGED
|
@@ -20,13 +20,14 @@
|
|
|
20
20
|
|
|
21
21
|
import { performance, PerformanceObserver } from 'node:perf_hooks'
|
|
22
22
|
import * as SOAP from 'soap'
|
|
23
|
-
import dotenv from 'dotenv'
|
|
24
23
|
import pRetry, { AbortError as RetryAbortError } from 'p-retry'
|
|
25
24
|
|
|
26
25
|
// Set AbortError correctly
|
|
27
26
|
const AbortError = RetryAbortError
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
for (const envFile of ['.env', '.env.defaults']) {
|
|
29
|
+
try { process.loadEnvFile(envFile) } catch {}
|
|
30
|
+
}
|
|
30
31
|
|
|
31
32
|
// This flag enables debug output including timing information.
|
|
32
33
|
const debug = process.env.DEBUG_SOAP === 'true'
|
package/.env.default
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# URL to the App Suite Middleware for e2e-provisioning via SOAP
|
|
2
|
-
PROVISIONING_URL=https://appsuite-main.dev.oxui.de/
|
|
3
|
-
|
|
4
|
-
# URL to the App Suite UI for e2e-tests
|
|
5
|
-
LAUNCH_URL=https://core-ui-main.dev.oxui.de
|
|
6
|
-
|
|
7
|
-
# admin credentials for e2e middleware
|
|
8
|
-
E2E_ADMIN_USER=
|
|
9
|
-
E2E_ADMIN_PW=
|
|
10
|
-
|
|
11
|
-
# Flag to enable/disable debug output for SOAP requests
|
|
12
|
-
DEBUG_SOAP=false
|
|
13
|
-
|
|
14
|
-
MX_DOMAIN=box.ox.io
|
|
15
|
-
|
|
16
|
-
PROVSIONING_API=common
|
|
17
|
-
|
|
18
|
-
DOTENV_CONFIG_QUIET=true
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"contexts": [
|
|
3
|
-
{
|
|
4
|
-
"data": {
|
|
5
|
-
"name": "test",
|
|
6
|
-
"capabilities": "switchboard,ai-service,spreadsheet,text,document_preview,presentation,presenter,remote_presenter",
|
|
7
|
-
"config": {
|
|
8
|
-
"entries": [{
|
|
9
|
-
"key": "config",
|
|
10
|
-
"value": {
|
|
11
|
-
"entries": [
|
|
12
|
-
{ "key": "io.ox/core//ai/openai/useAzure", "value": "false" }
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
}]
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"users": [
|
|
19
|
-
{
|
|
20
|
-
"name": "testuser",
|
|
21
|
-
"primaryEmail": "testuser-123@box.ox.io",
|
|
22
|
-
"display_name": "Test User",
|
|
23
|
-
"imapLogin": "testuser-123",
|
|
24
|
-
"imapServer": "main-dovecot",
|
|
25
|
-
"smtpServer": "main-postfix",
|
|
26
|
-
"email1": "testuser-123@box.ox.io",
|
|
27
|
-
"password": "secret",
|
|
28
|
-
"sur_name": "User",
|
|
29
|
-
"given_name": "Test"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"name": "testuser124",
|
|
33
|
-
"primaryEmail": "testuser-124@box.ox.io",
|
|
34
|
-
"display_name": "Test User",
|
|
35
|
-
"imapLogin": "testuser-124",
|
|
36
|
-
"imapServer": "main-dovecot",
|
|
37
|
-
"smtpServer": "main-postfix",
|
|
38
|
-
"email1": "testuser-124@box.ox.io",
|
|
39
|
-
"password": "secret",
|
|
40
|
-
"sur_name": "User",
|
|
41
|
-
"given_name": "Test124"
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
"secondaryAccount":
|
|
45
|
-
{
|
|
46
|
-
"name": "info123",
|
|
47
|
-
"login": "info123@box.ox.io",
|
|
48
|
-
"primaryAddress": "info123@box.ox.io",
|
|
49
|
-
"mailEndpointSource": "primary",
|
|
50
|
-
"transportEndpointSource": "primary",
|
|
51
|
-
"personal": "Info 123"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
}
|