@live-change/framework 0.6.5 → 0.6.8
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.
|
@@ -2,11 +2,13 @@ function getAccessMethod(access) {
|
|
|
2
2
|
if(typeof access == 'function') {
|
|
3
3
|
return access
|
|
4
4
|
} else if(Array.isArray(access)) {
|
|
5
|
-
return (params, {service, client}) => {
|
|
6
|
-
|
|
5
|
+
return (params, { service, client }) => {
|
|
6
|
+
if(client.roles.includes('administrator')) return true
|
|
7
|
+
if(client.roles.includes('admin')) return true
|
|
8
|
+
for(let role of access) if(client.roles.includes(role)) return true
|
|
7
9
|
return false
|
|
8
10
|
}
|
|
9
11
|
} else throw new Error("unknown view access definition "+access)
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
module.exports = getAccessMethod
|
|
14
|
+
module.exports = getAccessMethod
|
|
@@ -39,10 +39,14 @@ class ReaderModel {
|
|
|
39
39
|
})`, { tableName: this.tableName, id, fields }]
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
rangePath(range = {}) {
|
|
43
|
-
if(typeof range != 'object') {
|
|
44
|
-
const
|
|
45
|
-
|
|
42
|
+
rangePath(range = {}, pathRange = null) {
|
|
43
|
+
if(typeof range != 'object' || Array.isArray(range)) {
|
|
44
|
+
const values = Array.isArray(range) ? range : [range]
|
|
45
|
+
const prefix = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')
|
|
46
|
+
if(pathRange) {
|
|
47
|
+
return this.rangePath(utils.prefixRange(pathRange, prefix, prefix))
|
|
48
|
+
}
|
|
49
|
+
return this.rangePath({ gte: prefix+':', lte: prefix+'_\xFF\xFF\xFF\xFF' })
|
|
46
50
|
}
|
|
47
51
|
if(Array.isArray(range)) this.rangePath(range.join(','))
|
|
48
52
|
return ['database', 'tableRange', this.service.databaseName, this.tableName, range]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/framework",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "Live Change Framework - ultimate solution for real time mobile/web apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/live-change/live-change-framework",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@live-change/dao": "0.
|
|
25
|
-
"@live-change/dao-websocket": "0.
|
|
26
|
-
"@live-change/db": "0.5.
|
|
27
|
-
"@live-change/db-store-level": "0.5.
|
|
28
|
-
"@live-change/db-store-lmdb": "0.5.
|
|
29
|
-
"@live-change/sockjs": "
|
|
30
|
-
"@live-change/uid": "^0.6.
|
|
24
|
+
"@live-change/dao": "0.5.0",
|
|
25
|
+
"@live-change/dao-websocket": "0.5.0",
|
|
26
|
+
"@live-change/db": "0.5.13",
|
|
27
|
+
"@live-change/db-store-level": "0.5.13",
|
|
28
|
+
"@live-change/db-store-lmdb": "0.5.13",
|
|
29
|
+
"@live-change/sockjs": "0.4.1",
|
|
30
|
+
"@live-change/uid": "^0.6.8",
|
|
31
31
|
"cookie": "^0.4.1",
|
|
32
|
-
"express": "^4.
|
|
32
|
+
"express": "^4.18.1",
|
|
33
33
|
"os-service": "^2.2.0",
|
|
34
34
|
"rimraf": "^3.0.2",
|
|
35
35
|
"tape": "^5.3.2",
|
|
36
36
|
"websocket": "^1.0.34"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "74c4b8b2066b33bbdc37f76dd20d9ca4eb939239"
|
|
39
39
|
}
|