@cocreate/socket-server 1.7.5 → 1.7.7

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,18 @@
1
+ ## [1.7.7](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.7.6...v1.7.7) (2023-05-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Acesss Denied handeling of createOrg ([ca9152c](https://github.com/CoCreate-app/CoCreate-socket-server/commit/ca9152c3792e084fb12f5942772c40c757f30370))
7
+
8
+ ## [1.7.6](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.7.5...v1.7.6) (2023-05-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * apikey renamed to key ([b64597a](https://github.com/CoCreate-app/CoCreate-socket-server/commit/b64597af40ef4c3eb20e7e5e7f902a330db3f9d5))
14
+ * createOrg ([e859b23](https://github.com/CoCreate-app/CoCreate-socket-server/commit/e859b23662e41344defc53e066e4f17570e6e064))
15
+
1
16
  ## [1.7.5](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.7.4...v1.7.5) (2023-04-24)
2
17
 
3
18
 
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  "config": {
3
3
  "organization_id": "5ff747727005da1c272740ab",
4
- "apiKey": "2061acef-0451-4545-f754-60cf8160",
4
+ "key": "2061acef-0451-4545-f754-60cf8160",
5
5
  "host": "general.cocreate.app"
6
6
  },
7
7
  "sources": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/socket-server",
3
- "version": "1.7.5",
3
+ "version": "1.7.7",
4
4
  "description": "CoCreate-socket-server",
5
5
  "keywords": [
6
6
  "cocreate-socket",
package/src/index.js CHANGED
@@ -146,7 +146,6 @@ class SocketServer extends EventEmitter{
146
146
  if (this.authInstance)
147
147
  user_id = await this.authInstance.getUserId(req);
148
148
 
149
- //. check permission
150
149
  if (this.permissionInstance) {
151
150
  const permission = await this.permissionInstance.check(action, data, req, user_id)
152
151
  if (!permission || permission.error) {
@@ -154,8 +153,11 @@ class SocketServer extends EventEmitter{
154
153
  // if (action == 'syncServer')
155
154
  // this.emit('createDocument', socket, data);
156
155
  // else
157
- this.send(socket, 'Access Denied', {action, permission, data})
158
- return;
156
+ if (action !== 'createOrg')
157
+ return this.send(socket, 'Access Denied', {action, permission, ...data})
158
+ else
159
+ this.send(socket, 'Access Denied', {action, permission})
160
+
159
161
  }
160
162
  }
161
163
 
@@ -217,8 +219,8 @@ class SocketServer extends EventEmitter{
217
219
  for (let room of rooms) {
218
220
  let url = url;
219
221
  url += `/${room}`;
222
+
220
223
  const clients = this.clients.get(url);
221
-
222
224
  if (clients) {
223
225
  clients.forEach((client) => {
224
226
  if (socket != client && data.broadcast != false || socket == client && data.broadcastSender != false) {