I'm using the social account services to provide signup/login for my app with various social networks. Is it possible to assign users who use social login to roles and/or groups? I've looked at the accounts-role package and elsewhere but I can't figure out where to add the hooks, where to define roles, etc.
The Meteor.users
collection is just like any other collection and the only thing that the social account services do is add a user to that collection and add a facebook/twitter/github object to your user with some social network specific information. You can edit it just like a normal accounts-password
user account and add any extra data to it like roles. You could add a default role using the Accounts.onCreateUser
method and then adjust roles afterwards like so:
Accounts.onCreateUser(function(options, user) {
user.role = "standard"
return user;
});
By default the user object is restricted to just the profile object, so if you wanted to use the new role data you've added to your user object, you'd need to do a normal publication/subscription of it. Or if you didn't want to do that you could just add the role to the profile object:
Accounts.onCreateUser(function(options, user) {
user.profile.role = "standard"
return user;
});
And then make sure you don't allow it to be edited by a client side call using allow/deny rules. I'm guessing you don't want people to want to change their roles!