Beispiel #1
0
        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);
        }
Beispiel #2
0
        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));
        }