Skip to content

Commit

Permalink
Allow users to send setData and getData commands
Browse files Browse the repository at this point in the history
  • Loading branch information
João Neto authored and netoax committed Jul 4, 2019
1 parent d864f7c commit 6eb3bd7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/interactors/GetData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/interactors/SetData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6eb3bd7

Please sign in to comment.