@open-xchange/soap-client 0.0.6 → 0.0.7

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/bin/provision.js CHANGED
@@ -30,7 +30,7 @@ function checkEnvironmentVariables () {
30
30
  }
31
31
  }
32
32
 
33
- async function getOrCreateContext (data) {
33
+ async function getOrCreateContext (data, accessCombinationName = 'all') {
34
34
  const contextData = {
35
35
  ...{ maxQuota: -1 },
36
36
  ...data
@@ -44,7 +44,7 @@ async function getOrCreateContext (data) {
44
44
  context = existingContext[0]
45
45
  } else {
46
46
  console.log('Creating new context')
47
- context = await contextService.create(contextData, contextAdmin.admin)
47
+ context = await contextService.create(contextData, contextAdmin.admin, accessCombinationName)
48
48
  }
49
49
  return {
50
50
  ...context,
@@ -116,10 +116,10 @@ async function provisionFromFile (configPath) {
116
116
  for (const contexts of config.contexts || []) {
117
117
  try {
118
118
  const contextData = contexts.data
119
- const context = await getOrCreateContext({ name: contexts.data.name, admin: contexts.data.admin })
120
- if (contextData.capabilities) {
119
+ const context = await getOrCreateContext({ name: contexts.data.name, admin: contexts.data.admin, }, contextData.accessCombinationName || 'all')
120
+ if (contextData.capabilities || contextData.capabilitiesToRemove) {
121
121
  try {
122
- await contextService.changeCapabilities(context.id, contextData.capabilities, undefined)
122
+ await contextService.changeCapabilities(context.id, contextData.capabilities, contextData.capabilitiesToRemove)
123
123
  console.log('Changed capabilities for context:', context.id)
124
124
  } catch (capError) {
125
125
  console.error('Error changing capabilities for context', context.id, capError)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/soap-client",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "SOAP client for OX App Suite",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -58,7 +58,7 @@ export async function remove (id) {
58
58
  ```
59
59
  * @returns {Promise<Object>} The created context.
60
60
  */
61
- export async function create (ctx = {}, adminUser = {}) {
61
+ export async function create (ctx = {}, adminUser = {}, accessCombinationName = 'all') {
62
62
  return await (await OXContextService)
63
63
  .createAsync({
64
64
  ctx,
@@ -73,7 +73,7 @@ export async function create (ctx = {}, adminUser = {}) {
73
73
  }, adminUser)
74
74
  })
75
75
  .then(async context => {
76
- await changeModuleAccessByName(context.id, 'all')
76
+ await changeModuleAccessByName(context.id, accessCombinationName)
77
77
  return context
78
78
  })
79
79
  .catch(e => {