public async Task <IEnumerable <UserSessionProfile> > GetUserAllTeachers(bool getFromCache = true, bool storeInCache = true) { var searchParams = new UserSessionProfileSearchParams { GetFromCache = getFromCache, StoreInCache = storeInCache, Roles = await _userRoleMappingsProvider.GetUserRoleTeacherMappings(), }; return(await SearchUsers(searchParams)); }
public async Task <IEnumerable <UserSessionProfile> > SearchUsers(UserSessionProfileSearchParams searchParams) { var users = await GetUsersFromCacheOrApi(searchParams.GetFromCache, searchParams.StoreInCache); return(ApplyFilters(users, searchParams)); }
private IEnumerable <UserSessionProfile> ApplyFilters(IEnumerable <UserSessionProfile> users, UserSessionProfileSearchParams searchParams) { if (searchParams.Roles != null && searchParams.Roles.Count() > 0) { var roles = new HashSet <string>(searchParams.Roles); users = ApplyFilterRoles(users, roles); } users = ApplyFilterSecure(users); users = ApplyFilterSort(users); return(users.ToList()); }