@cocreate/socket-server 1.6.11 → 1.7.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # [1.7.0](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.6.11...v1.7.0) (2023-03-19)
2
+
3
+
4
+ ### Features
5
+
6
+ * if permmision returns db urls store in socket instance to allow crud to connect to user defined databases ([8342334](https://github.com/CoCreate-app/CoCreate-socket-server/commit/83423348c070a8985305ebf087ac83d538a6bc80))
7
+ * updated permission to return db urls to connect to 1 or more custom databases ([291fa5f](https://github.com/CoCreate-app/CoCreate-socket-server/commit/291fa5f14c8ef3ab82686935ee232dff413ad51d))
8
+
1
9
  ## [1.6.11](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.6.10...v1.6.11) (2023-02-01)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/socket-server",
3
- "version": "1.6.11",
3
+ "version": "1.7.0",
4
4
  "description": "CoCreate-socket-server",
5
5
  "keywords": [
6
6
  "cocreate-socket",
package/src/index.js CHANGED
@@ -147,15 +147,16 @@ class SocketServer extends EventEmitter{
147
147
 
148
148
  //. check permission
149
149
  if (this.permissionInstance) {
150
- const passStatus = await this.permissionInstance.check(action, data, req, user_id)
151
- if (passStatus !== true) {
152
- // if (action == 'syncServer' && passStatus.database === true)
150
+ const permission = await this.permissionInstance.check(action, data, req, user_id)
151
+ if (!permission || permission.status === false) {
152
+ // if (action == 'syncServer' && permission.database === true)
153
153
  // if (action == 'syncServer')
154
154
  // this.emit('createDocument', socket, data);
155
155
  // else
156
- this.send(socket, 'Access Denied', {action, passStatus, data})
156
+ this.send(socket, 'Access Denied', {action, permission, data})
157
157
  return;
158
- }
158
+ } else if (permission.dbs)
159
+ socket.dbs = permission.dbs
159
160
  }
160
161
 
161
162
  if (user_id) {