Hi all,
Adrian Lanning mentioned in his dev shop presentation that access control should be implemented based on action, rather than job title:
However, the alanning:roles package seems oriented towards defining user roles, which typically take a ‘job title’ form (admin, staff, etc). How can we augment the roles package to create groups of action-based permissions (i.e. creating a group-based Access Control List):
admin
insert
update
delete
manage-secrets
user
insert
updateOwn
deleteOwn
What are some options and common patterns to combine user groups with access control verbs (e.g. ‘can’) in Meteor.js projects?
References
In searching for existing solutions, I have found the following resources to be inspiring.
Just name them what you want. ‘create-post’, ‘edit-post’
From the readme
#What’s in a name…
Although the name of this package is ‘roles’, you can define your permissions however you like. You can have traditional roles like, “admin” or “webmaster”. But you can also assign more granular permissions such as, “view-secrets” or “manage-users”. Often times this is actually better because you are able to handle all those pesky edge cases that come up in real life usage without creating a ton of higher-level ‘roles’. To the roles package, its all strings.
@benjick, thanks for your clarification. I still think roles (in the ‘job title’ sense, see below) are useful, as they allow bundles of permissions to be assigned simultaneously. E.g.
admin
insert
update
delete
user
insert
updateOwn
deleteOwn
How can we create groups of permissions, such as grouping by user role? The documentation on role groups in aldeed:roles is somewhat vague as to their purpose, so I am unsure whether they are useful for this purpose.
Sure I’ve actually developed my own permission system on top of it. Unfortunately it’s really tightly coupled to my app but works great!
The basic idea here is that I have collections for dentists, patients etc. and I can create useraccounts for any of them. I can then allow
them to interact with other documents/ collections, by settings permissions. These include a reference to another module,
safety queries and allowed fields (I’m using my saveFind in publications) as well as checks for method calls.