Meteor-Community-Packages / meteor-roles

Authorization package for Meteor, compatible with built-in accounts packages
http://meteor-community-packages.github.io/meteor-roles/
MIT License
921 stars 168 forks source link

Pre-define set of groups & roles for them #82

Closed vbezruchkin closed 8 years ago

vbezruchkin commented 9 years ago

Greetings,

I tried to find a doc on how to create a pre-defined set of groups and roles for them. I would like to have a set of groups, that already have some defined roles. From your docs I could only understand it allows to assign roles to user as id param seems to be mandatory.

Could you please confirm if there is a way to create groups, define set of roles for them without passing a user ID? If not, I would be grateful if you could shed some light on this.

Thanks in advance.

martinhbramwell commented 9 years ago

+1

alanning commented 9 years ago

Hi @vbezruchkin, my apologies for not seeing your question earlier. If I am understanding your needs correctly, you would like to set up a hierarchy of roles so that if you assign a user to a top-level role, that user automatically receives the lower-level roles as well.

meteor-roles does not currently support hierarchies but there is another package called meteor-authorization that does. It is a fork of an earlier version of meteor-roles so it does not have support for groups but not sure if that matters for your use-case.

Just to make sure there's no misunderstanding, in the context of meteor-roles, groups are partitions that allow users to have different roles for each group. So you could imagine a user having permission to write in one group but only read in another.

mitar commented 8 years ago

With v2.0 version (currently in development in branch) you can have a hierarchy of roles. So you can define of roles as "groups" and then another as "roles".

If you are talking about groups as they were before in this package (now in v2.0 they are named partitions) then there is no need to predefine them in advance. You only have to create roles. If you do want to have some list of groups and information which roles are allowed for which group, then you should manage this yourself. See this comment for more information.

vbezruchkin commented 8 years ago

Cool, thanks guys.