Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #81 from nyambati/develop
Browse files Browse the repository at this point in the history
Merge develop hotfix to master
  • Loading branch information
nyambati authored Jun 25, 2017
2 parents 48a7bc2 + a1f7c83 commit b4ed786
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/nacl.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function config(config, response) {
opt.response = response;
opt.baseUrl = options.baseUrl;
opt.decodedObjectName = options.decodedObjectName;
opt.defautRole = options.defautRole || 'guest';
opt.defaultRole = options.defaultRole || 'guest';

if (options.rules) {
opt.rules = utils.validate(options.rules);
Expand Down Expand Up @@ -70,9 +70,19 @@ function authorize(req, res, next) {
* @type {[type]}
*/

let role = helper.getRole(req, res, opt.decodedObjectName, opt.defautRole);
let role = helper.getRole(req, res, opt.decodedObjectName, opt.defaultRole);

if (!_.isString(role) || !role) return;
/**
* if no role or role not provided as string
*/
if (!_.isString(role) || !role) {
return utils.deny(
res,
404,
'REQUIRED: Role should be provided as a string',
null
);
}

/**
* get resource from the url
Expand Down

0 comments on commit b4ed786

Please sign in to comment.