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

Add non-group role, remove it and add a group one next - doesn't work #211

Closed karolselak closed 4 years ago

karolselak commented 8 years ago

Fortunately I found out how to deal with it manually, but I still think that's a bug. After removing all non-group roles with removeUsersFromRoles method empty roles array still lasts in database, so if I want add some group role, I get error "Can't mix grouped and non-grouped roles for same user" and I'm forced to remove this field manually first.

All issue is to add one small check if removing element is the last one for this user.

karolselak commented 8 years ago

And in general, this case could also get more civilized when in attempt of adding a group role to non-group user whole non-group array would be converted to the __global_roles__ (or else named) field in the new roles object, without throwing the error.

mitar commented 4 years ago

I think this was an issue with v1.0 only. Use v2.0.