コード例 #1
0
        public async Task BulkDelete(string orgId, [FromBody] OrganizationUserBulkRequestModel model)
        {
            var orgGuidId = new Guid(orgId);

            if (!_currentContext.ManageUsers(orgGuidId))
            {
                throw new NotFoundException();
            }

            var userId = _userService.GetProperUserId(User);
            await _organizationService.DeleteUsersAsync(orgGuidId, model.Ids, userId.Value);
        }
コード例 #2
0
        public async Task <ListResponseModel <OrganizationUserBulkResponseModel> > BulkDelete(string orgId, [FromBody] OrganizationUserBulkRequestModel model)
        {
            var orgGuidId = new Guid(orgId);

            if (!await _currentContext.ManageUsers(orgGuidId))
            {
                throw new NotFoundException();
            }

            var userId = _userService.GetProperUserId(User);
            var result = await _organizationService.DeleteUsersAsync(orgGuidId, model.Ids, userId.Value);

            return(new ListResponseModel <OrganizationUserBulkResponseModel>(result.Select(r =>
                                                                                           new OrganizationUserBulkResponseModel(r.Item1.Id, r.Item2))));
        }
コード例 #3
0
        public async Task <ListResponseModel <OrganizationUserPublicKeyResponseModel> > UserPublicKeys(string orgId, [FromBody] OrganizationUserBulkRequestModel model)
        {
            var orgGuidId = new Guid(orgId);

            if (!await _currentContext.ManageUsers(orgGuidId))
            {
                throw new NotFoundException();
            }

            var result = await _organizationUserRepository.GetManyPublicKeysByOrganizationUserAsync(orgGuidId, model.Ids);

            var responses = result.Select(r => new OrganizationUserPublicKeyResponseModel(r.Id, r.UserId, r.PublicKey)).ToList();

            return(new ListResponseModel <OrganizationUserPublicKeyResponseModel>(responses));
        }