public async Task<GroupResponseModel> Get(string orgId, string id) { var group = await _groupRepository.GetByIdAsync(new Guid(id)); if (group == null || !await _currentContext.ManageGroups(group.OrganizationId)) { throw new NotFoundException(); } return new GroupResponseModel(group); }
public async Task <ListResponseModel <OrganizationUserUserDetailsResponseModel> > Get(string orgId) { var orgGuidId = new Guid(orgId); if (!_currentContext.ManageAssignedCollections(orgGuidId) && !_currentContext.ManageGroups(orgGuidId)) { throw new NotFoundException(); } var organizationUsers = await _organizationUserRepository.GetManyDetailsByOrganizationAsync(orgGuidId); var responseTasks = organizationUsers.Select(async o => new OrganizationUserUserDetailsResponseModel(o, await _userService.TwoFactorIsEnabledAsync(o))); var responses = await Task.WhenAll(responseTasks); return(new ListResponseModel <OrganizationUserUserDetailsResponseModel>(responses)); }