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 #80 from HussainAliAkbar/bg-roleStringValidation-79
Browse files Browse the repository at this point in the history
Fix: Issue#79: called the utils.deny function when the validation whe…
  • Loading branch information
nyambati authored Jun 23, 2017
2 parents bf87d22 + 5548ae3 commit 9a2186b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/nacl.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,17 @@ function authorize(req, res, next) {

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 9a2186b

Please sign in to comment.