Fix missing httpAdmin permissions for Pushbullet, twitter what3words and sensehatsim

fixes #244
This commit is contained in:
Dave Conway-Jones
2016-11-06 20:27:21 +00:00
parent a7247e898a
commit 7917ca8dcf
4 changed files with 13 additions and 73 deletions

View File

@@ -1,18 +1,3 @@
/**
* Copyright 2014 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
module.exports = function(RED) {
"use strict";
@@ -82,7 +67,7 @@ module.exports = function(RED) {
var querystring = require('querystring');
RED.httpAdmin.get('/what3words/:id', function(req, res) {
RED.httpAdmin.get('/what3words/:id', RED.auth.needsPermission('what3words.read'), function(req, res) {
var credentials = RED.nodes.getCredentials(req.params.id);
if (credentials) {
res.send(JSON.stringify({hasPassword:(credentials.pushkey && credentials.pushkey !== "")}));
@@ -91,12 +76,12 @@ module.exports = function(RED) {
}
});
RED.httpAdmin.delete('/what3words/:id', function(req, res) {
RED.httpAdmin.delete('/what3words/:id', RED.auth.needsPermission('what3words.write'), function(req, res) {
RED.nodes.deleteCredentials(req.params.id);
res.send(200);
});
RED.httpAdmin.post('/what3words/:id', function(req, res) {
RED.httpAdmin.post('/what3words/:id', RED.auth.needsPermission('what3words.write'), function(req, res) {
var body = "";
req.on('data', function(chunk) {
body += chunk;