OptimalBits / node_acl

Access control lists for node applications
2.62k stars 369 forks source link

Need levels of permissions #247

Closed ArtanisAce closed 7 years ago

ArtanisAce commented 7 years ago

Hi! I've started to use ACL, but I need to have 'level' of permissions in my app; I have 4 levels, and each level also grants the previous one. For some resources, just having level 1 is enough; for others you need level 3... how do you think I can handle this with acl API? If I could just add all the levels to an array and just look for one of them... is that possible? Thanks!

deksden commented 7 years ago

Just add "1", "2", "3" and "4" as permissions, then use some custom logic in ACL system to remove top-level permissions when removing something like "1" or "2".

ArtanisAce commented 7 years ago

I got a workaround for this; just when I have a level of '3', I add also permission for '2' and '1' separatedly. Works good. Thanks @deksden for your answer!!

deksden commented 7 years ago

@ArtanisAce : also you can try to use "hierarchical" role system: make role "1", then add role "2" with additional permissions, then make role "2" to have parent role "1".