@live-change/access-control-service 0.2.45 → 0.2.47
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/access.js +1 -0
- package/accessControl.js +13 -8
- package/package.json +3 -3
package/access.js
CHANGED
|
@@ -214,6 +214,7 @@ module.exports = (definition) => {
|
|
|
214
214
|
async function updateRoles() {
|
|
215
215
|
const roots = await Promise.all(rolesTreesRoots)
|
|
216
216
|
const accessesRoles = roots.map(root => computeNodeRoles(root))
|
|
217
|
+
output.debug(outputObjectId, "Accesses roles:", accessesRoles)
|
|
217
218
|
const firstAccessRoles = accessesRoles.shift()
|
|
218
219
|
let roles = firstAccessRoles
|
|
219
220
|
for(const accessRoles of accessesRoles) {
|
package/accessControl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const definition = require('./definition.js')
|
|
2
2
|
const App = require("@live-change/framework")
|
|
3
|
-
const { ObservableValue, ObservableList, ObservableProxy } = require("@live-change/dao")
|
|
3
|
+
const { ObservableValue, ObservableList, ObservableProxy, ObservablePromiseProxy } = require("@live-change/dao")
|
|
4
4
|
const app = App.app()
|
|
5
5
|
const access = require('./access.js')(definition)
|
|
6
6
|
|
|
@@ -20,9 +20,10 @@ definition.processor({
|
|
|
20
20
|
const [ properties, context, emit ] = args
|
|
21
21
|
const { client } = context
|
|
22
22
|
|
|
23
|
+
const { objectType, object } = properties
|
|
23
24
|
const objects = [].concat(
|
|
24
|
-
config.objects ? config.objects(properties) :
|
|
25
|
-
|
|
25
|
+
config.objects ? config.objects(properties) :
|
|
26
|
+
((objectType && object) ? [{ objectType, object }] : [])
|
|
26
27
|
)
|
|
27
28
|
if(objects.length == 0) {
|
|
28
29
|
throw new Error('no objects for access control to work')
|
|
@@ -48,8 +49,8 @@ definition.processor({
|
|
|
48
49
|
const { client } = context
|
|
49
50
|
const { objectType, object } = properties
|
|
50
51
|
const objects = [].concat(
|
|
51
|
-
config.objects ? config.objects(properties) :
|
|
52
|
-
|
|
52
|
+
config.objects ? config.objects(properties) :
|
|
53
|
+
((objectType && object) ? [{ objectType, object }] : [])
|
|
53
54
|
)
|
|
54
55
|
if(objects.length == 0) {
|
|
55
56
|
throw new Error('no objects for access control to work in view ' + viewName)
|
|
@@ -64,8 +65,8 @@ definition.processor({
|
|
|
64
65
|
const { client } = context
|
|
65
66
|
const { objectType, object } = properties
|
|
66
67
|
const objects = [].concat(
|
|
67
|
-
config.objects ? config.objects(properties) :
|
|
68
|
-
|
|
68
|
+
config.objects ? config.objects(properties) :
|
|
69
|
+
((objectType && object) ? [{ objectType, object }] : [])
|
|
69
70
|
)
|
|
70
71
|
if(objects.length == 0) {
|
|
71
72
|
throw new Error('no objects for access control to work')
|
|
@@ -88,8 +89,12 @@ definition.processor({
|
|
|
88
89
|
if(newAccessible !== accessible) {
|
|
89
90
|
if(newAccessible === true /*&& !valueObservable*/) {
|
|
90
91
|
valueObservable = oldObservable.apply(view, args)
|
|
92
|
+
if(valueObservable.then) {
|
|
93
|
+
valueObservable = new ObservablePromiseProxy(valueObservable)
|
|
94
|
+
}
|
|
91
95
|
}
|
|
92
|
-
observableProxy.setTarget(
|
|
96
|
+
observableProxy.setTarget(newAccessible ? valueObservable : errorObservable)
|
|
97
|
+
accessible = newAccessible
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
100
|
rolesObservable.observe(rolesObserver)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/access-control-service",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.47",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://www.viamage.com/"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/framework": "0.6.
|
|
24
|
+
"@live-change/framework": "0.6.12"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "710dc205163bf09d6b9469822101e9dfc11b74cb"
|
|
27
27
|
}
|