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); }
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)))); }
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)); }