From 6eb3bd7eeba45b9d3a9406d43fdbafdea98cddb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Neto?= Date: Wed, 3 Jul 2019 17:08:57 -0300 Subject: [PATCH] Allow users to send setData and getData commands --- src/interactors/GetData.js | 4 ++-- src/interactors/SetData.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/interactors/GetData.js b/src/interactors/GetData.js index d46a813..ba94617 100644 --- a/src/interactors/GetData.js +++ b/src/interactors/GetData.js @@ -13,8 +13,8 @@ class GetData { } const authDevice = await this.cloud.getDevice(credentials, credentials.uuid); - if (authDevice.type !== 'knot:app') { - throwError('Only apps can send \'getData\'', 400); + if (authDevice.type !== 'knot:app' && authDevice.type !== 'knot:users') { + throwError('Only apps and users can send \'getData\'', 400); } await this.cloud.sendMessage(credentials, data.id, 'command', { name: 'getData', args: data.sensorIds }, authDevice.knot.router); diff --git a/src/interactors/SetData.js b/src/interactors/SetData.js index 87746d5..ba76c3f 100644 --- a/src/interactors/SetData.js +++ b/src/interactors/SetData.js @@ -14,8 +14,8 @@ class SetData { } const authDevice = await this.cloud.getDevice(credentials, credentials.uuid); - if (authDevice.type !== 'knot:app') { - throwError('Only apps can send \'setData\'', 400); + if (authDevice.type !== 'knot:app' && authDevice.type !== 'knot:user') { + throwError('Only apps and users can send \'setData\'', 400); } const device = await this.cloud.getDevice(credentials, data.id, authDevice.knot.router);