javascript - Node Acl dynamic links -
i'm trying use npm module acl implement acl system. homepage can found here: https://github.com/optimalbits/node_acl.
the documentation shows lot of simple examples giving role access. in particular, there piece of code here:
acl.allow([ { roles:['guest','member'], allows:[ {resources:'blogs', permissions:'get'}, {resources:['forums','news'], permissions:['get','put','delete']} ] }, { roles:['gold','silver'], allows:[ {resources:'cash', permissions:['sell','exchange']}, {resources:['account','deposit'], permissions:['put','delete']} ] } ])
unfortunately, docs don't show examples of more complicated url '/blogs/:id/today'. possible set acls these kinds of dynamic urls?
and, need specify users can own information. means 'users/:id', should work if user's id same of url. possible?
their docs cover this, unless i'm missing something. taken readme:
the middleware accepts 3 optional arguments, useful in situations. example, cannot consider whole url resource:
app.put('/blogs/:id/comments/:commentid', acl.middleware(3), function(req, res, next){…}
in case resource 3 first components of url (without ending slash).
it possible add custom userid or check other permissions method:
app.put('/blogs/:id/comments/:commentid', acl.middleware(3, 'joed', 'post'), function(req, res, next){…}
Comments
Post a Comment