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 167 forks source link

Request to check user is in group? #207

Closed macroramesh6 closed 4 years ago

macroramesh6 commented 8 years ago

I am building a multi-domain website. so the users in a particular domain should not access from the another domain. I can create domain name as a role is not a wise idea for huge roles. So groups without role seems good.

I have created a group for the user without role Roles.addUsersToRoles(userId, [], 'domain1');

How should I check this user in the group like. Roles.userIsInGroup('domain1')

jerfowler commented 8 years ago

I would give the user at least one role, like user or active. Then you can check that to see if that user is a current active user.

Roles.userIsInRole(userId, 'active', 'domain1') or Roles.userIsInRole(userId, 'user', 'domain1')