Closed phocks closed 8 years ago
You have to decide if you are using groups or not. Can you share more of the code you are using?
I'm just running tests from meteor shell
> Roles.addUsersToRoles("jNX4BenrzyEgsMqTY", "admin");
> Roles.setUserRoles("jNX4BenrzyEgsMqTY", []);
> Roles.addUsersToRoles("jNX4BenrzyEgsMqTY", "admin", "default-group");
Error: Roles error: Can't mix grouped and non-grouped roles for same user
I think I've worked out what's happening anyway. When I added my user to the admin role with no group it created the group "admin" doc in db.groups. I'm guessing to use the "admin" role along with groups I would now have to go and delete the "admin" doc from the database and start again.
You are mixing groups and no groups. In the first command you have run it without groups. So now you are stuck with no groups.
Ahh yes I ran into that. Fixed it by deleting the roles: []
key from my user. Thanks for your help. It might not be too difficult to simply force using a "default-group' when no group is specified. I might fork and see if I can make a patch if I have time down the track.
Cheers.
This is fixed in the v2.0 branch, BTW. There you do not have such issues anymore.
Hi there, I'm just wondering is there a Roles.deleteUsersFromRoles( function to delete a user from the admin role. I tried using setUserRoles to [] but then when I tried adding a user to admin again + a group it gave me an error "Error: Roles error: Can't mix grouped and non-grouped roles for same user".