Commit b2b78367 by zCaesar

can pub

parent d5bac5a7
...@@ -26,7 +26,15 @@ module.exports = function (options = {}) { ...@@ -26,7 +26,15 @@ module.exports = function (options = {}) {
var response var response
var decoded = require('./checkClientRole').checkRealDB(req.body.username) var decoded = require('jwt-verify').verify(req.body.username).res
// var decoded = require('./checkClientRole').checkRealDB(req.body.username)
// const util = require('util')
// console.log('-----------decode----------')
// console.log(util.inspect(decoded, false, null, true));
// console.log('-----------decode----------')
// console.log('-----------decodes----------')
// console.log(util.inspect(decodeds, false, null, true));
// console.log('-----------decodes----------')
if (decoded) { if (decoded) {
if (decoded.role === 'realtimedb') response = { 'result': 'ok' } if (decoded.role === 'realtimedb') response = { 'result': 'ok' }
else response = { 'result': 'no' } else response = { 'result': 'no' }
...@@ -37,7 +45,7 @@ module.exports = function (options = {}) { ...@@ -37,7 +45,7 @@ module.exports = function (options = {}) {
var GGID = require('./utils/getGroupID'); var GGID = require('./utils/getGroupID');
var output = {}; var output = {};
GGID.getGroupID(req.body.username, req.body.client_id, function(group) { GGID.getGroupID(req.body.username, req.body.client_id, function (group) {
var _ftopic = require('./utils/router').rewriteTopic(topic, 'pub', group, req.body.client_id, output); // get topic where concat with groupID var _ftopic = require('./utils/router').rewriteTopic(topic, 'pub', group, req.body.client_id, output); // get topic where concat with groupID
response = { response = {
'result': 'ok', 'result': 'ok',
......
...@@ -27,7 +27,10 @@ module.exports = function (options = {}) { ...@@ -27,7 +27,10 @@ module.exports = function (options = {}) {
var response var response
var decoded = require('jwt-verify').verify(req.body.username).res var decoded = require('jwt-verify').verify(req.body.username).res
// var decoded = require('./checkClientRole').checkRealDB(req.body.username) // var decoded = require('./checkClientRole').checkRealDB(req.body.username)
const util = require('util')
console.log('-----------decode----------')
console.log(util.inspect(decoded, false, null, true));
console.log('-----------decode----------')
if (decoded) { if (decoded) {
if (decoded.role === 'realtimedb') response = { 'result': 'ok' } if (decoded.role === 'realtimedb') response = { 'result': 'ok' }
else response = { 'result': 'no' } else response = { 'result': 'no' }
...@@ -37,7 +40,7 @@ module.exports = function (options = {}) { ...@@ -37,7 +40,7 @@ module.exports = function (options = {}) {
else { else {
var GGID = require('./utils/getGroupID'); var GGID = require('./utils/getGroupID');
GGID.getGroupID(req.body.username, req.body.client_id, function(group) { GGID.getGroupID(req.body.username, req.body.client_id, function (group) {
console.log(group); console.log(group);
var _ftopic = require('./utils/router').rewriteTopic(topic, 'sub', group, req.body.client_id) // get topic where concat with groupID var _ftopic = require('./utils/router').rewriteTopic(topic, 'sub', group, req.body.client_id) // get topic where concat with groupID
var _topic = [{ // setTopic for response var _topic = [{ // setTopic for response
......
...@@ -973,6 +973,14 @@ ...@@ -973,6 +973,14 @@
"norma": "0.4" "norma": "0.4"
} }
}, },
"util": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/util/-/util-0.11.0.tgz",
"integrity": "sha512-5n12uMzKCjvB2HPFHnbQSjaqAa98L5iIXmHrZCLavuZVe0qe/SJGbDGWlpaHk5lnBkWRDO+dRu1/PgmUYKPPTw==",
"requires": {
"inherits": "2.0.3"
}
},
"util-deprecate": { "util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
......
...@@ -12,10 +12,11 @@ ...@@ -12,10 +12,11 @@
"dependencies": { "dependencies": {
"config": "^1.30.0", "config": "^1.30.0",
"jsonwebtoken": "^8.3.0", "jsonwebtoken": "^8.3.0",
"jwt-verify": "git+https://nexpienpm:CCqLQjg4ytvzN7QbssUV@dev.nexpie.com/npm/jwt-verify.git#issuer",
"lru-cache": "^4.1.3", "lru-cache": "^4.1.3",
"restify": "^7.1.1", "restify": "^7.1.1",
"seneca": "^3.6.0", "seneca": "^3.6.0",
"jwt-verify": "git+https://nexpienpm:CCqLQjg4ytvzN7QbssUV@dev.nexpie.com/npm/jwt-verify.git#issuer" "util": "^0.11.0"
}, },
"devDependencies": { "devDependencies": {
"mocha": "^5.2.0" "mocha": "^5.2.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment