public IOrderedEnumerable <TicketDeskUser> GetUsersInRole(string roleName, TicketDeskUserManager userManager)
 {
     return(this
            .FindByName(roleName)
            .Users
            .GetUsersInRole(userManager)
            .OrderBy(u => u.DisplayName));
 }
        public static void ConfigureDataProtection(this TicketDeskUserManager userManager, IAppBuilder app)
        {
            //TODO: research DpapiDataProtectionProvider and figure out what the f*** this is supposed to do
            var dataProtectionProvider = app.GetDataProtectionProvider();

            if (dataProtectionProvider != null)
            {
                userManager.UserTokenProvider = new DataProtectorTokenProvider <TicketDeskUser>(dataProtectionProvider.Create("ASP.NET Identity"));
            }
        }
 public IOrderedEnumerable <TicketDeskUser> GetTdPendingUsers(TicketDeskUserManager userManager)
 {
     return(GetUsersInRole("TdPendingUsers", userManager));
 }
 public IOrderedEnumerable <TicketDeskUser> GetTdTdAdministrators(TicketDeskUserManager userManager)
 {
     return(GetUsersInRole("", userManager));
 }
 public static UserDisplayInfo GetUserInfo(this TicketDeskUserManager userManager, string userId)
 {
     return(userManager.InfoCache.GetUserInfo(userId) ?? new UserDisplayInfo());
 }
        public IOrderedEnumerable <TicketDeskUser> GetUsersInRole(string[] roleNames, TicketDeskUserManager userManager)
        {
            var foundUsers = new List <TicketDeskUser>();

            foreach (var roleName in roleNames)
            {
                foundUsers.AddRange(
                    this
                    .FindByName(roleName)
                    .Users
                    .GetUsersInRole(userManager)
                    .Where(u => foundUsers.All(f => f.Id != u.Id))
                    );
            }
            return(foundUsers.OrderBy(u => u.DisplayName));
        }
 public IOrderedEnumerable <TicketDeskUser> GetTdHelpDeskUsers(TicketDeskUserManager userManager)
 {
     return(GetUsersInRole(new[] { "TdHelpDeskUsers", "TdAdministrators" }, userManager));
 }