@open-xchange/soap-client 0.1.6 → 0.2.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 +24 -1
- package/README.md +23 -0
- package/client.js +72 -0
- package/package.json +18 -7
- package/services/common/context.js +144 -131
- package/services/common/user.js +121 -100
- package/services/common/util.js +23 -9
- package/services/reseller/oxaas.js +23 -11
- package/services/reseller/resellerContext.js +45 -29
- package/services/reseller/resellerUser.js +81 -63
- package/services/secondaryAccount.js +61 -46
- package/services/sharedAccount.js +120 -104
- package/soap.js +142 -43
- package/test/soap.test.js +0 -268
- package/vitest.config.js +0 -8
package/services/common/user.js
CHANGED
|
@@ -18,117 +18,138 @@
|
|
|
18
18
|
* Any use of the work other than as authorized under this license or copyright law is prohibited.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { createClientAsync, logSoapError } from '../../soap.js'
|
|
22
|
-
|
|
23
|
-
let OXUserService
|
|
24
|
-
function getClient () {
|
|
25
|
-
if (!OXUserService) OXUserService = createClientAsync('OXUserService')
|
|
26
|
-
return OXUserService
|
|
27
|
-
}
|
|
21
|
+
import { createClientAsync, memoizeClient, logSoapError } from '../../soap.js'
|
|
28
22
|
|
|
29
23
|
/**
|
|
30
|
-
*
|
|
31
|
-
* @param {
|
|
32
|
-
* @
|
|
33
|
-
* @returns {Promise<Boolean>} Returns true if it could remove the user and false if it could not
|
|
24
|
+
* Build a user service bound to a SOAP client constructor.
|
|
25
|
+
* @param {(type: string) => Promise<Object>} createClient
|
|
26
|
+
* @returns {Object} The user service.
|
|
34
27
|
*/
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
ctx: { id: context.id },
|
|
38
|
-
user: { id: userId },
|
|
39
|
-
auth: context.admin
|
|
40
|
-
}).catch(logSoapError)
|
|
41
|
-
}
|
|
28
|
+
export function createUserService (createClient) {
|
|
29
|
+
const getClient = memoizeClient(createClient, 'OXUserService')
|
|
42
30
|
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
31
|
+
/**
|
|
32
|
+
* This function removes the user with the specified context and user ID.
|
|
33
|
+
* @param {Object} context The context of the user to be removed.
|
|
34
|
+
* @param {number} userId The ID of the user to be removed.
|
|
35
|
+
* @returns {Promise<Boolean>} Returns true if it could remove the user and false if it could not
|
|
36
|
+
*/
|
|
37
|
+
async function remove (context, userId) {
|
|
38
|
+
return (await getClient()).deleteAsync({
|
|
39
|
+
ctx: { id: context.id },
|
|
40
|
+
user: { id: userId },
|
|
41
|
+
auth: context.admin
|
|
42
|
+
}).catch(logSoapError)
|
|
43
|
+
}
|
|
56
44
|
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
45
|
+
/**
|
|
46
|
+
* This function creates a new user.
|
|
47
|
+
* @param {Object} context The context of the user to be created.
|
|
48
|
+
* @param {Object} usrdata The user to create.
|
|
49
|
+
* @returns {Promise<Object>} The created user.
|
|
50
|
+
*/
|
|
51
|
+
async function create (context, usrdata) {
|
|
52
|
+
return (await getClient()).createAsync({
|
|
53
|
+
ctx: { id: context.id },
|
|
54
|
+
usrdata,
|
|
55
|
+
auth: context.admin
|
|
56
|
+
})
|
|
57
|
+
}
|
|
70
58
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
59
|
+
/**
|
|
60
|
+
* This function changes the user with the specified data. Only the fields
|
|
61
|
+
* present in usrdata are sent.
|
|
62
|
+
* @param {Object} context The context of the user to be changed.
|
|
63
|
+
* @param {Object} usrdata The user to change.
|
|
64
|
+
* @returns {Promise<void>}
|
|
65
|
+
*/
|
|
66
|
+
async function change (context, usrdata) {
|
|
67
|
+
return (await getClient()).changeAsync({
|
|
68
|
+
ctx: { id: context.id },
|
|
69
|
+
usrdata,
|
|
70
|
+
auth: context.admin
|
|
71
|
+
})
|
|
72
|
+
}
|
|
79
73
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
74
|
+
async function changeByModuleAccess (context, userId, currentAccess, moduleAccess) {
|
|
75
|
+
return (await getClient()).changeByModuleAccessAsync({
|
|
76
|
+
ctx: { id: context.id },
|
|
77
|
+
moduleAccess: Object.assign({}, currentAccess, moduleAccess),
|
|
78
|
+
user: { id: userId },
|
|
79
|
+
auth: context.admin
|
|
80
|
+
})
|
|
81
|
+
}
|
|
88
82
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
83
|
+
async function changeByModuleAccessName (context, userId, accessCombinationName) {
|
|
84
|
+
return (await getClient()).changeByModuleAccessNameAsync({
|
|
85
|
+
ctx: { id: context.id },
|
|
86
|
+
access_combination_name: accessCombinationName,
|
|
87
|
+
user: { id: userId },
|
|
88
|
+
auth: context.admin
|
|
89
|
+
})
|
|
90
|
+
}
|
|
98
91
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
92
|
+
async function getModuleAccess (context, userId) {
|
|
93
|
+
return (await getClient()).getModuleAccessAsync({
|
|
94
|
+
ctx: { id: context.id },
|
|
95
|
+
user: { id: userId },
|
|
96
|
+
auth: context.admin
|
|
97
|
+
})
|
|
104
98
|
}
|
|
105
|
-
if (capsToAdd) data.capsToAdd = capsToAdd
|
|
106
|
-
if (capsToRemove) data.capsToRemove = capsToRemove
|
|
107
|
-
return (await getClient()).changeCapabilitiesAsync(data)
|
|
108
|
-
}
|
|
109
99
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
100
|
+
async function changeCapabilities (context, userId, capsToAdd, capsToRemove) {
|
|
101
|
+
const data = {
|
|
102
|
+
ctx: { id: context.id },
|
|
103
|
+
user: { id: userId },
|
|
104
|
+
auth: context.admin
|
|
105
|
+
}
|
|
106
|
+
if (capsToAdd) data.capsToAdd = capsToAdd
|
|
107
|
+
if (capsToRemove) data.capsToRemove = capsToRemove
|
|
108
|
+
return (await getClient()).changeCapabilitiesAsync(data)
|
|
109
|
+
}
|
|
117
110
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
111
|
+
async function exists (context, userId) {
|
|
112
|
+
return (await getClient()).existsAsync({
|
|
113
|
+
ctx: { id: context.id },
|
|
114
|
+
user: { id: userId },
|
|
115
|
+
auth: context.admin
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async function list (context, searchPattern, includeGuests = false) {
|
|
120
|
+
return (await getClient()).listAsync({
|
|
121
|
+
ctx: { id: context.id },
|
|
122
|
+
search_pattern: searchPattern,
|
|
123
|
+
include_guests: includeGuests,
|
|
124
|
+
auth: context.admin
|
|
125
|
+
})
|
|
126
|
+
}
|
|
126
127
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
async function listAll (context, includeGuests = false, excludeUsers = []) {
|
|
129
|
+
return (await getClient()).listAsync({
|
|
130
|
+
ctx: { id: context.id },
|
|
131
|
+
include_guests: includeGuests,
|
|
132
|
+
exclude_users: excludeUsers,
|
|
133
|
+
auth: context.admin
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return { remove, create, change, changeByModuleAccess, changeByModuleAccessName, getModuleAccess, changeCapabilities, exists, list, listAll }
|
|
134
138
|
}
|
|
139
|
+
|
|
140
|
+
// Classic module exports, bound to the env-configured default endpoint.
|
|
141
|
+
// Note: changeByModuleAccessName used to swallow SOAP errors via console.error;
|
|
142
|
+
// it now rejects like every other operation (see CHANGELOG, Unreleased).
|
|
143
|
+
let defaultService
|
|
144
|
+
const service = () => (defaultService ??= createUserService(createClientAsync))
|
|
145
|
+
|
|
146
|
+
export const remove = (...args) => service().remove(...args)
|
|
147
|
+
export const create = (...args) => service().create(...args)
|
|
148
|
+
export const change = (...args) => service().change(...args)
|
|
149
|
+
export const changeByModuleAccess = (...args) => service().changeByModuleAccess(...args)
|
|
150
|
+
export const changeByModuleAccessName = (...args) => service().changeByModuleAccessName(...args)
|
|
151
|
+
export const getModuleAccess = (...args) => service().getModuleAccess(...args)
|
|
152
|
+
export const changeCapabilities = (...args) => service().changeCapabilities(...args)
|
|
153
|
+
export const exists = (...args) => service().exists(...args)
|
|
154
|
+
export const list = (...args) => service().list(...args)
|
|
155
|
+
export const listAll = (...args) => service().listAll(...args)
|
package/services/common/util.js
CHANGED
|
@@ -18,18 +18,32 @@
|
|
|
18
18
|
* Any use of the work other than as authorized under this license or copyright law is prohibited.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { createClientAsync } from '../../soap.js'
|
|
21
|
+
import { createClientAsync, memoizeClient } from '../../soap.js'
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @
|
|
24
|
+
* Build a util service bound to a SOAP client constructor.
|
|
25
|
+
* @param {(type: string) => Promise<Object>} createClient
|
|
26
|
+
* @returns {Object} The util service.
|
|
26
27
|
*/
|
|
27
|
-
|
|
28
|
+
export function createUtilService (createClient) {
|
|
29
|
+
const getClient = memoizeClient(createClient, 'OXUtilService')
|
|
30
|
+
let fileStoreId
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
/**
|
|
33
|
+
* This function retrieves the ID of the first filestorage.
|
|
34
|
+
* @returns {Promise<number>} The ID of the first filestorage.
|
|
35
|
+
*/
|
|
36
|
+
async function getFilestorageId () {
|
|
37
|
+
if (fileStoreId) return fileStoreId
|
|
38
|
+
fileStoreId = (await (await getClient()).listFilestoreAsync())[0]?.id
|
|
39
|
+
return fileStoreId
|
|
40
|
+
}
|
|
31
41
|
|
|
32
|
-
|
|
33
|
-
fileStoreId = (await (await OXUtilService).listFilestoreAsync())[0]?.id
|
|
34
|
-
return fileStoreId
|
|
42
|
+
return { getFilestorageId }
|
|
35
43
|
}
|
|
44
|
+
|
|
45
|
+
// Classic module export, bound to the env-configured default endpoint.
|
|
46
|
+
let defaultService
|
|
47
|
+
const service = () => (defaultService ??= createUtilService(createClientAsync))
|
|
48
|
+
|
|
49
|
+
export const getFilestorageId = (...args) => service().getFilestorageId(...args)
|
|
@@ -18,18 +18,30 @@
|
|
|
18
18
|
* Any use of the work other than as authorized under this license or copyright law is prohibited.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { createClientAsync } from '../../soap.js'
|
|
21
|
+
import { createClientAsync, memoizeClient } from '../../soap.js'
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Build an OXaaS service bound to a SOAP client constructor.
|
|
25
|
+
* @param {(type: string) => Promise<Object>} createClient
|
|
26
|
+
* @returns {Object} The OXaaS service.
|
|
27
|
+
*/
|
|
28
|
+
export function createOxaasService (createClient) {
|
|
29
|
+
const getClient = memoizeClient(createClient, 'OXaaSService')
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
31
|
+
async function setMailQuota (data) {
|
|
32
|
+
return (await getClient()).setMailQuotaAsync(data)
|
|
33
|
+
}
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
async function createSharedDomain (data) {
|
|
36
|
+
return (await getClient()).createSharedDomainAsync(data)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return { setMailQuota, createSharedDomain }
|
|
35
40
|
}
|
|
41
|
+
|
|
42
|
+
// Classic module exports, bound to the env-configured default endpoint.
|
|
43
|
+
let defaultService
|
|
44
|
+
const service = () => (defaultService ??= createOxaasService(createClientAsync))
|
|
45
|
+
|
|
46
|
+
export const setMailQuota = (...args) => service().setMailQuota(...args)
|
|
47
|
+
export const createSharedDomain = (...args) => service().createSharedDomain(...args)
|
|
@@ -18,42 +18,58 @@
|
|
|
18
18
|
* Any use of the work other than as authorized under this license or copyright law is prohibited.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { createClientAsync, logSoapError } from '../../soap.js'
|
|
21
|
+
import { createClientAsync, memoizeClient, logSoapError } from '../../soap.js'
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Build a reseller-context service bound to a SOAP client constructor.
|
|
25
|
+
* @param {(type: string) => Promise<Object>} createClient
|
|
26
|
+
* @returns {Object} The reseller context service.
|
|
27
|
+
*/
|
|
28
|
+
export function createResellerContextService (createClient) {
|
|
29
|
+
const getClient = memoizeClient(createClient, 'OXResellerContextService')
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
31
|
+
async function create (data) {
|
|
32
|
+
return (await getClient()).createAsync(data)
|
|
33
|
+
}
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
35
|
+
async function remove (contextId) {
|
|
36
|
+
return (await getClient()).deleteAsync({
|
|
37
|
+
ctx: { id: contextId }
|
|
38
|
+
}).catch(logSoapError)
|
|
39
|
+
}
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
41
|
+
async function change (ctx) {
|
|
42
|
+
return (await getClient()).changeAsync({ ctx })
|
|
43
|
+
}
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
45
|
+
async function get (id) {
|
|
46
|
+
return (await getClient()).getDataAsync({ ctx: { id } })
|
|
47
|
+
}
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
49
|
+
async function getModuleAccess (id) {
|
|
50
|
+
return (await getClient()).getModuleAccessAsync({ ctx: id })
|
|
51
|
+
}
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
async function changeModuleAccess (id, access) {
|
|
54
|
+
const currentAccess = await getModuleAccess(id)
|
|
55
|
+
return (await getClient()).changeModuleAccessAsync({ ctx: { id }, access: { ...currentAccess, ...access } })
|
|
56
|
+
}
|
|
53
57
|
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
async function listAll (data) {
|
|
59
|
+
return (await getClient()).listAllAsync(data)
|
|
60
|
+
}
|
|
56
61
|
|
|
57
|
-
|
|
58
|
-
return (await getClient()).listAllAsync(data)
|
|
62
|
+
return { create, remove, change, get, getModuleAccess, changeModuleAccess, listAll }
|
|
59
63
|
}
|
|
64
|
+
|
|
65
|
+
// Classic module exports, bound to the env-configured default endpoint.
|
|
66
|
+
let defaultService
|
|
67
|
+
const service = () => (defaultService ??= createResellerContextService(createClientAsync))
|
|
68
|
+
|
|
69
|
+
export const create = (...args) => service().create(...args)
|
|
70
|
+
export const remove = (...args) => service().remove(...args)
|
|
71
|
+
export const change = (...args) => service().change(...args)
|
|
72
|
+
export const get = (...args) => service().get(...args)
|
|
73
|
+
export const getModuleAccess = (...args) => service().getModuleAccess(...args)
|
|
74
|
+
export const changeModuleAccess = (...args) => service().changeModuleAccess(...args)
|
|
75
|
+
export const listAll = (...args) => service().listAll(...args)
|
|
@@ -18,76 +18,94 @@
|
|
|
18
18
|
* Any use of the work other than as authorized under this license or copyright law is prohibited.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { createClientAsync, logSoapError } from '../../soap.js'
|
|
22
|
-
|
|
23
|
-
let OXResellerUserService
|
|
24
|
-
function getClient () {
|
|
25
|
-
if (!OXResellerUserService) OXResellerUserService = createClientAsync('OXResellerUserService')
|
|
26
|
-
return OXResellerUserService
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export async function remove (contextId, userId) {
|
|
30
|
-
return (await getClient()).deleteAsync({
|
|
31
|
-
ctx: { id: contextId },
|
|
32
|
-
user: { id: userId }
|
|
33
|
-
}).catch(logSoapError)
|
|
34
|
-
}
|
|
21
|
+
import { createClientAsync, memoizeClient, logSoapError } from '../../soap.js'
|
|
35
22
|
|
|
36
23
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @param {
|
|
39
|
-
* @
|
|
40
|
-
* @returns {Promise<void>}
|
|
24
|
+
* Build a reseller-user service bound to a SOAP client constructor.
|
|
25
|
+
* @param {(type: string) => Promise<Object>} createClient
|
|
26
|
+
* @returns {Object} The reseller user service.
|
|
41
27
|
*/
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
ctx: { id: context.id },
|
|
45
|
-
usrdata,
|
|
46
|
-
auth: { login: context.admin.name, password: context.admin.password }
|
|
47
|
-
})
|
|
48
|
-
}
|
|
28
|
+
export function createResellerUserService (createClient) {
|
|
29
|
+
const getClient = memoizeClient(createClient, 'OXResellerUserService')
|
|
49
30
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
31
|
+
async function remove (contextId, userId) {
|
|
32
|
+
return (await getClient()).deleteAsync({
|
|
33
|
+
ctx: { id: contextId },
|
|
34
|
+
user: { id: userId }
|
|
35
|
+
}).catch(logSoapError)
|
|
36
|
+
}
|
|
53
37
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
38
|
+
/**
|
|
39
|
+
* This function changes the user with the specified data.
|
|
40
|
+
* @param {Object} context The context of the user to be changed.
|
|
41
|
+
* @param {Object} usrdata The user to change.
|
|
42
|
+
* @returns {Promise<void>}
|
|
43
|
+
*/
|
|
44
|
+
async function change (context, usrdata) {
|
|
45
|
+
return (await getClient()).changeAsync({
|
|
46
|
+
ctx: { id: context.id },
|
|
47
|
+
usrdata,
|
|
48
|
+
auth: { login: context.admin.name, password: context.admin.password }
|
|
49
|
+
})
|
|
50
|
+
}
|
|
63
51
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
moduleAccess: Object.assign({}, currentAccess, moduleAccess),
|
|
68
|
-
user: { id: userId },
|
|
69
|
-
auth: { login: context.admin.name, password: context.admin.password }
|
|
70
|
-
})
|
|
71
|
-
}
|
|
52
|
+
async function get (data) {
|
|
53
|
+
return (await getClient()).getDataAsync(data)
|
|
54
|
+
}
|
|
72
55
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
}
|
|
56
|
+
async function getModuleAccess (context, userId) {
|
|
57
|
+
return (await getClient()).getModuleAccessAsync({
|
|
58
|
+
ctx: { id: context.id },
|
|
59
|
+
user: { id: userId },
|
|
60
|
+
auth: { login: context.admin.name, password: context.admin.password }
|
|
61
|
+
})
|
|
62
|
+
}
|
|
81
63
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
64
|
+
async function changeByModuleAccess (context, userId, currentAccess, moduleAccess) {
|
|
65
|
+
return (await getClient()).changeByModuleAccessAsync({
|
|
66
|
+
ctx: { id: context.id },
|
|
67
|
+
moduleAccess: Object.assign({}, currentAccess, moduleAccess),
|
|
68
|
+
user: { id: userId },
|
|
69
|
+
auth: { login: context.admin.name, password: context.admin.password }
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function changeByModuleAccessName (context, userId, accessCombinationName) {
|
|
74
|
+
return (await getClient()).changeByModuleAccessNameAsync({
|
|
75
|
+
ctx: { id: context.id },
|
|
76
|
+
access_combination_name: accessCombinationName,
|
|
77
|
+
user: { id: userId },
|
|
78
|
+
auth: { login: context.admin.name, password: context.admin.password }
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function createByModuleAccessName (context, usrdata) {
|
|
83
|
+
return (await getClient()).createByModuleAccessNameAsync({
|
|
84
|
+
ctx: { id: context.id },
|
|
85
|
+
usrdata,
|
|
86
|
+
access_combination_name: 'all',
|
|
87
|
+
auth: { login: context.admin.name, password: context.admin.password }
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
async function listAll (data) {
|
|
92
|
+
return (await getClient()).listAllAsync(data)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return { remove, change, get, getModuleAccess, changeByModuleAccess, changeByModuleAccessName, createByModuleAccessName, listAll }
|
|
93
96
|
}
|
|
97
|
+
|
|
98
|
+
// Classic module exports, bound to the env-configured default endpoint.
|
|
99
|
+
// Note: changeByModuleAccessName used to swallow SOAP errors via console.error;
|
|
100
|
+
// it now rejects like every other operation (see CHANGELOG, Unreleased).
|
|
101
|
+
let defaultService
|
|
102
|
+
const service = () => (defaultService ??= createResellerUserService(createClientAsync))
|
|
103
|
+
|
|
104
|
+
export const remove = (...args) => service().remove(...args)
|
|
105
|
+
export const change = (...args) => service().change(...args)
|
|
106
|
+
export const get = (...args) => service().get(...args)
|
|
107
|
+
export const getModuleAccess = (...args) => service().getModuleAccess(...args)
|
|
108
|
+
export const changeByModuleAccess = (...args) => service().changeByModuleAccess(...args)
|
|
109
|
+
export const changeByModuleAccessName = (...args) => service().changeByModuleAccessName(...args)
|
|
110
|
+
export const createByModuleAccessName = (...args) => service().createByModuleAccessName(...args)
|
|
111
|
+
export const listAll = (...args) => service().listAll(...args)
|