Esempio n. 1
0
        public void UpdateUserRoles(User user, List <string> roles)
        {
            var currentRoles = Roles.GetRolesForUser(user.UserName);

            if (currentRoles != null && currentRoles.Length > 0)
            {
                Roles.RemoveUserFromRoles(user.UserName, currentRoles);
            }

            Roles.AddUserToRoles(user.UserName, roles.ToArray());
        }
Esempio n. 2
0
        public List <string> GetRolesForUser(string userName)
        {
            var roles = Roles.GetRolesForUser(userName);

            return(roles.ToList());
        }
Esempio n. 3
0
 public string[] GetRolesForCurrentUser()
 {
     ApplicationServiceHelper.EnsureRoleServiceEnabled();
     return(Roles.GetRolesForUser());
 }