Skip to content

Commit

Permalink
feat(routes): PUT /session 403 if id role missing
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Nov 29, 2015
1 parent 08eaec9 commit 36f0049
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions utils/session/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function createSession (options, callback) {

var accountId = findIdInRoles(body.roles)
var isAdmin = hasAdminRole(body.roles)

if (!isAdmin && !accountId) {
return callback(Boom.forbidden(('"id:..." role missing (https://github.com/hoodiehq/hoodie-server-account/blob/master/how-it-works.md#id-role)')))
}

var session = {
id: bearerToken,
account: {
Expand Down

0 comments on commit 36f0049

Please sign in to comment.