Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add support for wildcard actions.

  • Loading branch information...
commit c387b73def522bf581de031a77cf0cf69f84f8d6 1 parent 5c8f7fa
Hector Virgen authored
3  lib/permission.js
View
@@ -15,7 +15,8 @@ Permission.prototype.match = function(role, resource, action) {
case (this.role == null && this.resource == null && this.action == null): // Global rule
case (this.role == _role && this.resource == null && this.action == action): // Global rule on role
case (this.role == null && this.resource == _resource && this.action == action): // Global rule on resource
- case (this.role == null && this.resource == _resource && this.action == null): // Global rule on action
+ case (this.role == _role && this.resource == _resource && this.action == null): // Global rule on action
+ case (this.role == null && this.resource == _resource && this.action == null): // Global rule on role and action
case (this.role == null && this.resource == null && this.action == action): // Global rule on role and resource
case (this.role == null && this.resource == resource && this.action == null): // Global rule on role and action
case (this.role == _role && this.resource == null && this.action == null): // Global rule on resource and action
8 package.json
View
@@ -1,10 +1,14 @@
{
"name": "virgen-acl",
- "version": "0.0.16",
+ "version": "0.0.17",
"description": "A fast in-memory ACL with role/resource inheritance and support for custom assertions.",
"main": "lib/index.js",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/djvirgen/virgen-acl.git"
+ },
"scripts": {
- "test": "mocha --reporter spec"
+ "test": "mocha"
},
"devDependencies": {
"mocha": "~1.6.0",
8 test/index.js
View
@@ -79,6 +79,7 @@ require('should');
this.acl = new Acl();
this.acl.allow('foo', 'bar', allowedActions);
this.acl.deny('foo', 'bar', deniedActions);
+ this.acl.allow('derp', 'doo');
});
for (var i in allowedActions) (function(action) {
@@ -98,6 +99,13 @@ require('should');
});
});
})(deniedActions[i]);
+
+ it("supports wildcard actions", function(done) {
+ this.acl.query('derp', 'doo', 'anything', function(err, allowed) {
+ allowed.should.equal(true);
+ done();
+ });
+ });
});
describe('query', function() {
5 test/mocha.opts
View
@@ -0,0 +1,5 @@
+--require should
+--reporter spec
+--ui bdd
+--compilers coffee:coffee-script
+--globals config
Please sign in to comment.
Something went wrong with that request. Please try again.