Authentication and Permissions

Is there a way to register a user and at the same time assign a role and/or permission?

It seems that assign roles requires an existing admin account.

You definitely don’t want users that registers themselves to also be able to choose what roles they’re in, which is why the Assign/UnAssign Roles Services require Admin access.

You can create a new User with Roles in a single call by using the IUserAuthRepository class directly, e.g:

var authRepo = (IUserAuthRepository)base.AuthRepository;
authRepo.CreateUserAuth(new UserAuth {
    ...
    Roles = new List<string> { "RoleA", "RoleB" }
});