Auto-Provision-add user to role

Topics: Troubleshooting, Writing modules
Mar 19, 2014 at 10:11 PM
In the auto-provision module I'm writing, I need to be able to add a user to a role in the tenant that is being created. Accessing services in the tenant seems to be pretty straight forward, but adding a user to a role involves accessing the UserRolesRepository. Is there a way to access a repository in a tenant using a similar method for accessing services?

Thanks =)
Mar 21, 2014 at 6:06 AM
Got this one figured out. Didn't know I could do:
                        var role = roleService.GetRoleByName("Editor");

                        if (role != null) {
                            var userRolesRepository = environment.Resolve<IRepository<UserRolesPartRecord>>();

                            userRolesRepository.Create(new UserRolesPartRecord { Role = role, UserId = user.Id });
                        }
Works great! Next step is to create a custom role in a custom recipe and add the user to that role instead.
Marked as answer by psenechal on 3/20/2014 at 10:06 PM