-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
It would be a nice touch if I was able to use a fourth argument in the assertion function to verify against single instances or other arbitrary custom data. Example, considering the current identity name to be Dezmond:
var ownPost = {
owner: "Dezmond"
}
var post = {
owner: "Foo"
}
AclService.allow('Manager', 'Post');
AclService.allow('User', 'Post', null, function (role, resource, privilege, data) {
return role.name === data.owner;
});
AclService.can('Manager', 'Post', null, post) // true
AclService.can('User', 'Post', null, ownPost) // true
AclService.can('User', 'Post', null, post) // false
AclService.can('User', 'Post', null) // trueThis would add way more flexibility to how one can use the can or isAllowed functions and, if I'm not wrong, it doesn't break any current interface.
I'd be happy to submit a PR implementing this feature.
Best.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels