@live-change/access-control-service 0.8.81 → 0.8.83

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 (3) hide show
  1. package/access.js +9 -19
  2. package/invite.js +3 -1
  3. package/package.json +3 -3
package/access.js CHANGED
@@ -108,13 +108,7 @@ export default (definition) => {
108
108
  return roles
109
109
  }
110
110
 
111
- async function checkRoles(client, { objectType, object, objects }, callback, ignorePublic) {
112
- const allObjects = ((objectType && object) ? [{ objectType, object }] : []).concat(objects || [])
113
- const roles = await getClientObjectsRoles(client, allObjects, ignorePublic)
114
- //console.log('checkRoles', allObjects, roles)
115
- //console.trace("CHECK ROLES!")
116
- return await callback(roles, client, { objectType, object })
117
- }
111
+
118
112
 
119
113
  /// QUERIES:
120
114
 
@@ -309,19 +303,15 @@ export default (definition) => {
309
303
  }]
310
304
  }
311
305
 
312
- /*
313
- function accessLimitedGet(client, objects, requiredRoles, path) {
314
- const roles = getClientObjectsRoles(client, objects)
315
- for(const requiredRole of requiredRoles) {
316
-
317
- }
318
- }
319
-
320
- function accessLimitedObservable(client, objects, path) {
321
- if(path[0] !== 'database') throw new Error("non database path "+ JSON.stringify(path))
322
- const isObject = path[1] === 'queryObject' || path[1] === ''
306
+ async function checkRoles(client, { objectType, object, objects }, callback, ignorePublic) {
307
+ const allObjects = ((objectType && object) ? [{ objectType, object }] : []).concat(objects || [])
308
+ //const roles = await getClientObjectsRoles(client, allObjects, ignorePublic)
309
+ const access = await app.dao.get(accessPath(client, allObjects))
310
+ const roles = access.roles
311
+ //console.log('checkRoles', allObjects, roles)
312
+ //console.trace("CHECK ROLES!")
313
+ return await callback(roles, client, { objectType, object })
323
314
  }
324
- */
325
315
 
326
316
  return {
327
317
  testRoles,
package/invite.js CHANGED
@@ -136,7 +136,9 @@ definition.trigger({
136
136
  console.error("INVITE WITH MESSAGE AUTHENTICATED", { contactType, contact, session, objectType, object })
137
137
  const contactTypeUpperCase = contactType[0].toUpperCase() + contactType.slice(1)
138
138
  /// Load invitation
139
- const invitation = App.encodeIdentifier([ contactType + '_' + contactTypeUpperCase, contact, objectType, object ])
139
+ const invitation = App.encodeIdentifier([
140
+ contactType + '_' + contactTypeUpperCase, contact, objectType, object
141
+ ])
140
142
  console.log("INVITATION", invitation)
141
143
  const invitationData = await AccessInvitation.get(invitation)
142
144
  if(!invitationData) throw 'not_found'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/access-control-service",
3
- "version": "0.8.81",
3
+ "version": "0.8.83",
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.8.81"
24
+ "@live-change/framework": "^0.8.83"
25
25
  },
26
- "gitHead": "bbc862b339eae9c68cb4b06cad0abdbb0405b409",
26
+ "gitHead": "a3c85f0869b4c65c2bdd6f181bdfcbe2d6f2bde5",
27
27
  "type": "module"
28
28
  }