mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 00:52:49 -05:00
[PM-10325] Rename OrganizationUser Delete and BulkDelete endpoints to Remove and BulkRemove (#4711)
* Rename IDeleteOrganizationUserCommand to IRemoveOrganizationUserCommand * Rename IOrganizationService DeleteUser methods to RemoveUser * Rename API endpoints for deleting organization users to "Remove" * chore: Rename Delete method to Remove in MembersController
This commit is contained in:
@ -506,8 +506,8 @@ public class OrganizationUsersController : Controller
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
[HttpPost("{id}/delete")]
|
||||
public async Task Delete(string orgId, string id)
|
||||
[HttpPost("{id}/remove")]
|
||||
public async Task Remove(string orgId, string id)
|
||||
{
|
||||
var orgGuidId = new Guid(orgId);
|
||||
if (!await _currentContext.ManageUsers(orgGuidId))
|
||||
@ -516,12 +516,12 @@ public class OrganizationUsersController : Controller
|
||||
}
|
||||
|
||||
var userId = _userService.GetProperUserId(User);
|
||||
await _organizationService.DeleteUserAsync(orgGuidId, new Guid(id), userId.Value);
|
||||
await _organizationService.RemoveUserAsync(orgGuidId, new Guid(id), userId.Value);
|
||||
}
|
||||
|
||||
[HttpDelete("")]
|
||||
[HttpPost("delete")]
|
||||
public async Task<ListResponseModel<OrganizationUserBulkResponseModel>> BulkDelete(string orgId, [FromBody] OrganizationUserBulkRequestModel model)
|
||||
[HttpPost("remove")]
|
||||
public async Task<ListResponseModel<OrganizationUserBulkResponseModel>> BulkRemove(string orgId, [FromBody] OrganizationUserBulkRequestModel model)
|
||||
{
|
||||
var orgGuidId = new Guid(orgId);
|
||||
if (!await _currentContext.ManageUsers(orgGuidId))
|
||||
@ -530,7 +530,7 @@ public class OrganizationUsersController : Controller
|
||||
}
|
||||
|
||||
var userId = _userService.GetProperUserId(User);
|
||||
var result = await _organizationService.DeleteUsersAsync(orgGuidId, model.Ids, userId.Value);
|
||||
var result = await _organizationService.RemoveUsersAsync(orgGuidId, model.Ids, userId.Value);
|
||||
return new ListResponseModel<OrganizationUserBulkResponseModel>(result.Select(r =>
|
||||
new OrganizationUserBulkResponseModel(r.Item1.Id, r.Item2)));
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ public class OrganizationsController : Controller
|
||||
}
|
||||
|
||||
|
||||
await _organizationService.DeleteUserAsync(orgGuidId, user.Id);
|
||||
await _organizationService.RemoveUserAsync(orgGuidId, user.Id);
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
|
@ -226,24 +226,24 @@ public class MembersController : Controller
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete a member.
|
||||
/// Remove a member.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Permanently deletes a member from the organization. This cannot be undone.
|
||||
/// Permanently removes a member from the organization. This cannot be undone.
|
||||
/// The user account will still remain. The user is only removed from the organization.
|
||||
/// </remarks>
|
||||
/// <param name="id">The identifier of the member to be deleted.</param>
|
||||
/// <param name="id">The identifier of the member to be removed.</param>
|
||||
[HttpDelete("{id}")]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||
public async Task<IActionResult> Delete(Guid id)
|
||||
public async Task<IActionResult> Remove(Guid id)
|
||||
{
|
||||
var user = await _organizationUserRepository.GetByIdAsync(id);
|
||||
if (user == null || user.OrganizationId != _currentContext.OrganizationId)
|
||||
{
|
||||
return new NotFoundResult();
|
||||
}
|
||||
await _organizationService.DeleteUserAsync(_currentContext.OrganizationId.Value, id, null);
|
||||
await _organizationService.RemoveUserAsync(_currentContext.OrganizationId.Value, id, null);
|
||||
return new OkResult();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user