예제 #1
0
        public virtual async Task <PagedResultDto <IdentityUserDto> > GetUsersAsync(Guid?ouId, GetIdentityUsersInput userInput)
        {
            if (!ouId.HasValue)
            {
                return(await UserAppService.GetListAsync(userInput));
            }
            IEnumerable <IdentityUser> list = new List <IdentityUser>();
            var ou = await UnitRepository.GetAsync(ouId.Value);

            var selfAndChildren = await UnitRepository.GetAllChildrenWithParentCodeAsync(ou.Code, ou.Id);

            selfAndChildren.Add(ou);
            //Consider submitting PR to get its own overloading method containing all the members of the child node
            foreach (var child in selfAndChildren)
            {
                // Find child nodes where users have duplicates (users can have multiple organizations)
                //count += await UnitRepository.GetMembersCountAsync(child, usersInput.Filter);
                list = Enumerable.Union(list, await UnitRepository.GetMembersAsync(
                                            child,
                                            userInput.Sorting,
                                            //usersInput.MaxResultCount, // So let's think about looking up all the members of the subset
                                            //usersInput.SkipCount,
                                            filter: userInput.Filter
                                            ));
            }
            return(new PagedResultDto <IdentityUserDto>(
                       list.Count(),
                       ObjectMapper.Map <List <IdentityUser>, List <IdentityUserDto> >(
                           list.Skip(userInput.SkipCount).Take(userInput.MaxResultCount)
                           .ToList()
                           )
                       ));
        }
예제 #2
0
 public override async Task <PagedResultDto <IdentityUserDto> > GetListAsync([FromQuery] GetIdentityUsersInput input)
 {
     using (dataFilter.Disable())
     {
         return(await UserAppService.GetListAsync(input));
     }
 }