Skip to content

Commit

Permalink
Add admittance module
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalsadhu committed Mar 6, 2014
1 parent e64a55c commit 6df4fee
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions admittance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

var util = require('util')

var permissions = {}

var admittance = function (userid) {
return {
is: function (permission) {

if (util.isArray(permissions[userid]))
if (permissions[userid].indexOf(permission) !== -1) return true

return permissions[userid] === permission
}
}
}

admittance.load = function (permissionData) {
permissions = permissionData
}

module.exports = admittance

0 comments on commit 6df4fee

Please sign in to comment.