mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
make codacy be quieter
tweak some lint notes: missing semicolons, mixed double vs single quote, unused variables (it's still unused...)
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@ function configure (app, wares, env, ctx) {
|
||||
, head: wares.get_head( )
|
||||
, settings: env.settings
|
||||
, extendedSettings: app.extendedClientSettings
|
||||
, authorized: ctx.authorization.authorize(req.query.token || "")
|
||||
, authorized: ctx.authorization.authorize(req.query.token || '')
|
||||
};
|
||||
|
||||
var badge = 'http://img.shields.io/badge/Nightscout-OK-green';
|
||||
|
||||
@@ -69,7 +69,7 @@ function init (env, authorization) {
|
||||
} else {
|
||||
res.json({ });
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
endpoints.get('/roles', authorization.isPermitted('authorization:roles:list'), function getRoles (req, res) {
|
||||
|
||||
@@ -6,6 +6,14 @@ var shiroTrie = require('shiro-trie');
|
||||
|
||||
var consts = require('./../constants');
|
||||
|
||||
function mkopts (opts) {
|
||||
var options = opts && !_.isEmpty(opts) ? opts : { };
|
||||
if (!options.redirectDeniedURL) {
|
||||
options.redirectDeniedURL = null;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
function init (env, ctx) {
|
||||
var authorization = { };
|
||||
var storage = authorization.storage = require('./storage')(env, ctx);
|
||||
@@ -64,6 +72,7 @@ function init (env, ctx) {
|
||||
authorization.isPermitted = function isPermitted (permission, opts) {
|
||||
|
||||
|
||||
opts = mkopts(opts);
|
||||
authorization.seenPermissions = _.chain(authorization.seenPermissions)
|
||||
.push(permission)
|
||||
.sort()
|
||||
@@ -79,7 +88,6 @@ function init (env, ctx) {
|
||||
|
||||
var token = extractToken(req) || findByAccess(req);
|
||||
|
||||
// req.auth = token;
|
||||
var builtin = shiroTrie.new();
|
||||
var defaultPermissions = storage.rolesToPermissions(defaultRoles);
|
||||
builtin.add(defaultPermissions);
|
||||
@@ -91,7 +99,6 @@ function init (env, ctx) {
|
||||
} else {
|
||||
console.info('Verified Authorization', verified);
|
||||
var permissions = storage.findSubjectPermissions(verified.accessToken);
|
||||
// permissions.add(defaultPermissions);
|
||||
if (permissions.check(permission) || builtin.check(permission)) {
|
||||
next( );
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user