@live-change/access-control-service 0.9.155 → 0.9.156

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.
Files changed (2) hide show
  1. package/accessControl.js +8 -3
  2. package/package.json +3 -3
package/accessControl.js CHANGED
@@ -19,19 +19,24 @@ definition.processor({
19
19
  console.log("ACCESS CONTROL", service.name, "ACTION", action.name)
20
20
 
21
21
  const oldExec = action.execute
22
- action.execute = async (...args) => {
22
+ action.execute = async (...args) => {
23
23
  const [ properties, context, emit ] = args
24
24
  const { client } = context
25
-
25
+
26
26
  const { objectType, object } = properties
27
27
  const objects = [].concat(
28
28
  config.objects ? config.objects(properties) :
29
29
  ((objectType && object) ? [{ objectType, object }] : [])
30
30
  )
31
+
31
32
  if(objects.length === 0) {
32
33
  throw new Error('no objects for access control to work')
33
34
  }
34
- const accessible = access.clientHasAccessRoles(client, { objects }, config.roles)
35
+ const accessible = await access.clientHasAccessRoles(client, { objects }, config.roles)
36
+
37
+ console.log("ACTION", service.name, action.name, "ACCESS CONTROL TO",
38
+ objects, 'CLIENT', client, 'CONFIG', config, "ACCESSIBLE", accessible)
39
+
35
40
  if(!accessible) throw 'notAuthorized'
36
41
 
37
42
  return oldExec.apply(action, args)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/access-control-service",
3
- "version": "0.9.155",
3
+ "version": "0.9.156",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,8 +21,8 @@
21
21
  "url": "https://www.viamage.com/"
22
22
  },
23
23
  "dependencies": {
24
- "@live-change/framework": "^0.9.155"
24
+ "@live-change/framework": "^0.9.156"
25
25
  },
26
- "gitHead": "b4ac9f54917102e4c3ee7662f31d8829a17a1525",
26
+ "gitHead": "3042fdd1df2a3b696fb7f161304eb23d71b70ad5",
27
27
  "type": "module"
28
28
  }