mirror of
https://github.com/bitwarden/server
synced 2025-12-06 00:03:34 +00:00
Improve Swagger OperationIDs for AC (#6236)
This commit is contained in:
@@ -163,7 +163,6 @@ public class GroupsController : Controller
|
||||
}
|
||||
|
||||
[HttpPut("{id}")]
|
||||
[HttpPost("{id}")]
|
||||
public async Task<GroupResponseModel> Put(Guid orgId, Guid id, [FromBody] GroupRequestModel model)
|
||||
{
|
||||
if (!await _currentContext.ManageGroups(orgId))
|
||||
@@ -237,8 +236,14 @@ public class GroupsController : Controller
|
||||
return new GroupResponseModel(group);
|
||||
}
|
||||
|
||||
[HttpPost("{id}")]
|
||||
[Obsolete("This endpoint is deprecated. Use PUT method instead")]
|
||||
public async Task<GroupResponseModel> PostPut(Guid orgId, Guid id, [FromBody] GroupRequestModel model)
|
||||
{
|
||||
return await Put(orgId, id, model);
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
[HttpPost("{id}/delete")]
|
||||
public async Task Delete(string orgId, string id)
|
||||
{
|
||||
var group = await _groupRepository.GetByIdAsync(new Guid(id));
|
||||
@@ -250,8 +255,14 @@ public class GroupsController : Controller
|
||||
await _deleteGroupCommand.DeleteAsync(group);
|
||||
}
|
||||
|
||||
[HttpPost("{id}/delete")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
public async Task PostDelete(string orgId, string id)
|
||||
{
|
||||
await Delete(orgId, id);
|
||||
}
|
||||
|
||||
[HttpDelete("")]
|
||||
[HttpPost("delete")]
|
||||
public async Task BulkDelete([FromBody] GroupBulkRequestModel model)
|
||||
{
|
||||
var groups = await _groupRepository.GetManyByManyIds(model.Ids);
|
||||
@@ -267,9 +278,15 @@ public class GroupsController : Controller
|
||||
await _deleteGroupCommand.DeleteManyAsync(groups);
|
||||
}
|
||||
|
||||
[HttpPost("delete")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
public async Task PostBulkDelete([FromBody] GroupBulkRequestModel model)
|
||||
{
|
||||
await BulkDelete(model);
|
||||
}
|
||||
|
||||
[HttpDelete("{id}/user/{orgUserId}")]
|
||||
[HttpPost("{id}/delete-user/{orgUserId}")]
|
||||
public async Task Delete(string orgId, string id, string orgUserId)
|
||||
public async Task DeleteUser(string orgId, string id, string orgUserId)
|
||||
{
|
||||
var group = await _groupRepository.GetByIdAsync(new Guid(id));
|
||||
if (group == null || !await _currentContext.ManageGroups(group.OrganizationId))
|
||||
@@ -279,4 +296,11 @@ public class GroupsController : Controller
|
||||
|
||||
await _groupService.DeleteUserAsync(group, new Guid(orgUserId));
|
||||
}
|
||||
|
||||
[HttpPost("{id}/delete-user/{orgUserId}")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
public async Task PostDeleteUser(string orgId, string id, string orgUserId)
|
||||
{
|
||||
await DeleteUser(orgId, id, orgUserId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,6 @@ public class OrganizationConnectionsController : Controller
|
||||
}
|
||||
|
||||
[HttpDelete("{organizationConnectionId}")]
|
||||
[HttpPost("{organizationConnectionId}/delete")]
|
||||
public async Task DeleteConnection(Guid organizationConnectionId)
|
||||
{
|
||||
var connection = await _organizationConnectionRepository.GetByIdAsync(organizationConnectionId);
|
||||
@@ -158,6 +157,13 @@ public class OrganizationConnectionsController : Controller
|
||||
await _deleteOrganizationConnectionCommand.DeleteAsync(connection);
|
||||
}
|
||||
|
||||
[HttpPost("{organizationConnectionId}/delete")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
public async Task PostDeleteConnection(Guid organizationConnectionId)
|
||||
{
|
||||
await DeleteConnection(organizationConnectionId);
|
||||
}
|
||||
|
||||
private async Task<ICollection<OrganizationConnection>> GetConnectionsAsync(Guid organizationId, OrganizationConnectionType type) =>
|
||||
await _organizationConnectionRepository.GetByOrganizationIdTypeAsync(organizationId, type);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class OrganizationDomainController : Controller
|
||||
}
|
||||
|
||||
[HttpGet("{orgId}/domain")]
|
||||
public async Task<ListResponseModel<OrganizationDomainResponseModel>> Get(Guid orgId)
|
||||
public async Task<ListResponseModel<OrganizationDomainResponseModel>> GetAll(Guid orgId)
|
||||
{
|
||||
await ValidateOrganizationAccessAsync(orgId);
|
||||
|
||||
@@ -105,7 +105,6 @@ public class OrganizationDomainController : Controller
|
||||
}
|
||||
|
||||
[HttpDelete("{orgId}/domain/{id}")]
|
||||
[HttpPost("{orgId}/domain/{id}/remove")]
|
||||
public async Task RemoveDomain(Guid orgId, Guid id)
|
||||
{
|
||||
await ValidateOrganizationAccessAsync(orgId);
|
||||
@@ -119,6 +118,13 @@ public class OrganizationDomainController : Controller
|
||||
await _deleteOrganizationDomainCommand.DeleteAsync(domain);
|
||||
}
|
||||
|
||||
[HttpPost("{orgId}/domain/{id}/remove")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
public async Task PostRemoveDomain(Guid orgId, Guid id)
|
||||
{
|
||||
await RemoveDomain(orgId, id);
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost("domain/sso/details")] // must be post to accept email cleanly
|
||||
public async Task<OrganizationDomainSsoDetailsResponseModel> GetOrgDomainSsoDetails(
|
||||
|
||||
@@ -98,7 +98,6 @@ public class OrganizationIntegrationConfigurationController(
|
||||
}
|
||||
|
||||
[HttpDelete("{configurationId:guid}")]
|
||||
[HttpPost("{configurationId:guid}/delete")]
|
||||
public async Task DeleteAsync(Guid organizationId, Guid integrationId, Guid configurationId)
|
||||
{
|
||||
if (!await HasPermission(organizationId))
|
||||
@@ -120,6 +119,13 @@ public class OrganizationIntegrationConfigurationController(
|
||||
await integrationConfigurationRepository.DeleteAsync(configuration);
|
||||
}
|
||||
|
||||
[HttpPost("{configurationId:guid}/delete")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
public async Task PostDeleteAsync(Guid organizationId, Guid integrationId, Guid configurationId)
|
||||
{
|
||||
await DeleteAsync(organizationId, integrationId, configurationId);
|
||||
}
|
||||
|
||||
private async Task<bool> HasPermission(Guid organizationId)
|
||||
{
|
||||
return await currentContext.OrganizationOwner(organizationId);
|
||||
|
||||
@@ -64,7 +64,6 @@ public class OrganizationIntegrationController(
|
||||
}
|
||||
|
||||
[HttpDelete("{integrationId:guid}")]
|
||||
[HttpPost("{integrationId:guid}/delete")]
|
||||
public async Task DeleteAsync(Guid organizationId, Guid integrationId)
|
||||
{
|
||||
if (!await HasPermission(organizationId))
|
||||
@@ -81,6 +80,13 @@ public class OrganizationIntegrationController(
|
||||
await integrationRepository.DeleteAsync(integration);
|
||||
}
|
||||
|
||||
[HttpPost("{integrationId:guid}/delete")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
public async Task PostDeleteAsync(Guid organizationId, Guid integrationId)
|
||||
{
|
||||
await DeleteAsync(organizationId, integrationId);
|
||||
}
|
||||
|
||||
private async Task<bool> HasPermission(Guid organizationId)
|
||||
{
|
||||
return await currentContext.OrganizationOwner(organizationId);
|
||||
|
||||
@@ -167,7 +167,7 @@ public class OrganizationUsersController : Controller
|
||||
}
|
||||
|
||||
[HttpGet("")]
|
||||
public async Task<ListResponseModel<OrganizationUserUserDetailsResponseModel>> Get(Guid orgId, bool includeGroups = false, bool includeCollections = false)
|
||||
public async Task<ListResponseModel<OrganizationUserUserDetailsResponseModel>> GetAll(Guid orgId, bool includeGroups = false, bool includeCollections = false)
|
||||
{
|
||||
var request = new OrganizationUserUserDetailsQueryRequest
|
||||
{
|
||||
@@ -360,7 +360,6 @@ public class OrganizationUsersController : Controller
|
||||
}
|
||||
|
||||
[HttpPut("{id}")]
|
||||
[HttpPost("{id}")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task Put(Guid orgId, Guid id, [FromBody] OrganizationUserUpdateRequestModel model)
|
||||
{
|
||||
@@ -436,6 +435,14 @@ public class OrganizationUsersController : Controller
|
||||
collectionsToSave, groupsToSave);
|
||||
}
|
||||
|
||||
[HttpPost("{id}")]
|
||||
[Obsolete("This endpoint is deprecated. Use PUT method instead")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task PostPut(Guid orgId, Guid id, [FromBody] OrganizationUserUpdateRequestModel model)
|
||||
{
|
||||
await Put(orgId, id, model);
|
||||
}
|
||||
|
||||
[HttpPut("{userId}/reset-password-enrollment")]
|
||||
public async Task PutResetPasswordEnrollment(Guid orgId, Guid userId, [FromBody] OrganizationUserResetPasswordEnrollmentRequestModel model)
|
||||
{
|
||||
@@ -492,7 +499,6 @@ public class OrganizationUsersController : Controller
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
[HttpPost("{id}/remove")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task Remove(Guid orgId, Guid id)
|
||||
{
|
||||
@@ -500,8 +506,15 @@ public class OrganizationUsersController : Controller
|
||||
await _removeOrganizationUserCommand.RemoveUserAsync(orgId, id, userId.Value);
|
||||
}
|
||||
|
||||
[HttpPost("{id}/remove")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task PostRemove(Guid orgId, Guid id)
|
||||
{
|
||||
await Remove(orgId, id);
|
||||
}
|
||||
|
||||
[HttpDelete("")]
|
||||
[HttpPost("remove")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task<ListResponseModel<OrganizationUserBulkResponseModel>> BulkRemove(Guid orgId, [FromBody] OrganizationUserBulkRequestModel model)
|
||||
{
|
||||
@@ -511,8 +524,15 @@ public class OrganizationUsersController : Controller
|
||||
new OrganizationUserBulkResponseModel(r.OrganizationUserId, r.ErrorMessage)));
|
||||
}
|
||||
|
||||
[HttpPost("remove")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task<ListResponseModel<OrganizationUserBulkResponseModel>> PostBulkRemove(Guid orgId, [FromBody] OrganizationUserBulkRequestModel model)
|
||||
{
|
||||
return await BulkRemove(orgId, model);
|
||||
}
|
||||
|
||||
[HttpDelete("{id}/delete-account")]
|
||||
[HttpPost("{id}/delete-account")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task DeleteAccount(Guid orgId, Guid id)
|
||||
{
|
||||
@@ -525,8 +545,15 @@ public class OrganizationUsersController : Controller
|
||||
await _deleteClaimedOrganizationUserAccountCommand.DeleteUserAsync(orgId, id, currentUser.Id);
|
||||
}
|
||||
|
||||
[HttpPost("{id}/delete-account")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task PostDeleteAccount(Guid orgId, Guid id)
|
||||
{
|
||||
await DeleteAccount(orgId, id);
|
||||
}
|
||||
|
||||
[HttpDelete("delete-account")]
|
||||
[HttpPost("delete-account")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task<ListResponseModel<OrganizationUserBulkResponseModel>> BulkDeleteAccount(Guid orgId, [FromBody] OrganizationUserBulkRequestModel model)
|
||||
{
|
||||
@@ -542,7 +569,14 @@ public class OrganizationUsersController : Controller
|
||||
new OrganizationUserBulkResponseModel(r.OrganizationUserId, r.ErrorMessage)));
|
||||
}
|
||||
|
||||
[HttpPatch("{id}/revoke")]
|
||||
[HttpPost("delete-account")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task<ListResponseModel<OrganizationUserBulkResponseModel>> PostBulkDeleteAccount(Guid orgId, [FromBody] OrganizationUserBulkRequestModel model)
|
||||
{
|
||||
return await BulkDeleteAccount(orgId, model);
|
||||
}
|
||||
|
||||
[HttpPut("{id}/revoke")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task RevokeAsync(Guid orgId, Guid id)
|
||||
@@ -550,7 +584,14 @@ public class OrganizationUsersController : Controller
|
||||
await RestoreOrRevokeUserAsync(orgId, id, _revokeOrganizationUserCommand.RevokeUserAsync);
|
||||
}
|
||||
|
||||
[HttpPatch("revoke")]
|
||||
[HttpPatch("{id}/revoke")]
|
||||
[Obsolete("This endpoint is deprecated. Use PUT method instead")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task PatchRevokeAsync(Guid orgId, Guid id)
|
||||
{
|
||||
await RevokeAsync(orgId, id);
|
||||
}
|
||||
|
||||
[HttpPut("revoke")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task<ListResponseModel<OrganizationUserBulkResponseModel>> BulkRevokeAsync(Guid orgId, [FromBody] OrganizationUserBulkRequestModel model)
|
||||
@@ -558,7 +599,14 @@ public class OrganizationUsersController : Controller
|
||||
return await RestoreOrRevokeUsersAsync(orgId, model, _revokeOrganizationUserCommand.RevokeUsersAsync);
|
||||
}
|
||||
|
||||
[HttpPatch("{id}/restore")]
|
||||
[HttpPatch("revoke")]
|
||||
[Obsolete("This endpoint is deprecated. Use PUT method instead")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task<ListResponseModel<OrganizationUserBulkResponseModel>> PatchBulkRevokeAsync(Guid orgId, [FromBody] OrganizationUserBulkRequestModel model)
|
||||
{
|
||||
return await BulkRevokeAsync(orgId, model);
|
||||
}
|
||||
|
||||
[HttpPut("{id}/restore")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task RestoreAsync(Guid orgId, Guid id)
|
||||
@@ -566,7 +614,14 @@ public class OrganizationUsersController : Controller
|
||||
await RestoreOrRevokeUserAsync(orgId, id, (orgUser, userId) => _restoreOrganizationUserCommand.RestoreUserAsync(orgUser, userId));
|
||||
}
|
||||
|
||||
[HttpPatch("restore")]
|
||||
[HttpPatch("{id}/restore")]
|
||||
[Obsolete("This endpoint is deprecated. Use PUT method instead")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task PatchRestoreAsync(Guid orgId, Guid id)
|
||||
{
|
||||
await RestoreAsync(orgId, id);
|
||||
}
|
||||
|
||||
[HttpPut("restore")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task<ListResponseModel<OrganizationUserBulkResponseModel>> BulkRestoreAsync(Guid orgId, [FromBody] OrganizationUserBulkRequestModel model)
|
||||
@@ -574,7 +629,14 @@ public class OrganizationUsersController : Controller
|
||||
return await RestoreOrRevokeUsersAsync(orgId, model, (orgId, orgUserIds, restoringUserId) => _restoreOrganizationUserCommand.RestoreUsersAsync(orgId, orgUserIds, restoringUserId, _userService));
|
||||
}
|
||||
|
||||
[HttpPatch("enable-secrets-manager")]
|
||||
[HttpPatch("restore")]
|
||||
[Obsolete("This endpoint is deprecated. Use PUT method instead")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task<ListResponseModel<OrganizationUserBulkResponseModel>> PatchBulkRestoreAsync(Guid orgId, [FromBody] OrganizationUserBulkRequestModel model)
|
||||
{
|
||||
return await BulkRestoreAsync(orgId, model);
|
||||
}
|
||||
|
||||
[HttpPut("enable-secrets-manager")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task BulkEnableSecretsManagerAsync(Guid orgId,
|
||||
@@ -607,6 +669,15 @@ public class OrganizationUsersController : Controller
|
||||
await _organizationUserRepository.ReplaceManyAsync(orgUsers);
|
||||
}
|
||||
|
||||
[HttpPatch("enable-secrets-manager")]
|
||||
[Obsolete("This endpoint is deprecated. Use PUT method instead")]
|
||||
[Authorize<ManageUsersRequirement>]
|
||||
public async Task PatchBulkEnableSecretsManagerAsync(Guid orgId,
|
||||
[FromBody] OrganizationUserBulkRequestModel model)
|
||||
{
|
||||
await BulkEnableSecretsManagerAsync(orgId, model);
|
||||
}
|
||||
|
||||
private async Task RestoreOrRevokeUserAsync(
|
||||
Guid orgId,
|
||||
Guid id,
|
||||
|
||||
@@ -225,7 +225,6 @@ public class OrganizationsController : Controller
|
||||
}
|
||||
|
||||
[HttpPut("{id}")]
|
||||
[HttpPost("{id}")]
|
||||
public async Task<OrganizationResponseModel> Put(string id, [FromBody] OrganizationUpdateRequestModel model)
|
||||
{
|
||||
var orgIdGuid = new Guid(id);
|
||||
@@ -252,6 +251,13 @@ public class OrganizationsController : Controller
|
||||
return new OrganizationResponseModel(organization, plan);
|
||||
}
|
||||
|
||||
[HttpPost("{id}")]
|
||||
[Obsolete("This endpoint is deprecated. Use PUT method instead")]
|
||||
public async Task<OrganizationResponseModel> PostPut(string id, [FromBody] OrganizationUpdateRequestModel model)
|
||||
{
|
||||
return await Put(id, model);
|
||||
}
|
||||
|
||||
[HttpPost("{id}/storage")]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task<PaymentResponseModel> PostStorage(string id, [FromBody] StorageRequestModel model)
|
||||
@@ -291,7 +297,6 @@ public class OrganizationsController : Controller
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
[HttpPost("{id}/delete")]
|
||||
public async Task Delete(string id, [FromBody] SecretVerificationRequestModel model)
|
||||
{
|
||||
var orgIdGuid = new Guid(id);
|
||||
@@ -334,6 +339,13 @@ public class OrganizationsController : Controller
|
||||
await _organizationDeleteCommand.DeleteAsync(organization);
|
||||
}
|
||||
|
||||
[HttpPost("{id}/delete")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
public async Task PostDelete(string id, [FromBody] SecretVerificationRequestModel model)
|
||||
{
|
||||
await Delete(id, model);
|
||||
}
|
||||
|
||||
[HttpPost("{id}/delete-recover-token")]
|
||||
[AllowAnonymous]
|
||||
public async Task PostDeleteRecoverToken(Guid id, [FromBody] OrganizationVerifyDeleteRecoverRequestModel model)
|
||||
|
||||
@@ -90,7 +90,7 @@ public class PoliciesController : Controller
|
||||
}
|
||||
|
||||
[HttpGet("")]
|
||||
public async Task<ListResponseModel<PolicyResponseModel>> Get(string orgId)
|
||||
public async Task<ListResponseModel<PolicyResponseModel>> GetAll(string orgId)
|
||||
{
|
||||
var orgIdGuid = new Guid(orgId);
|
||||
if (!await _currentContext.ManagePolicies(orgIdGuid))
|
||||
|
||||
@@ -93,7 +93,6 @@ public class ProviderOrganizationsController : Controller
|
||||
}
|
||||
|
||||
[HttpDelete("{id:guid}")]
|
||||
[HttpPost("{id:guid}/delete")]
|
||||
public async Task Delete(Guid providerId, Guid id)
|
||||
{
|
||||
if (!_currentContext.ManageProviderOrganizations(providerId))
|
||||
@@ -112,4 +111,11 @@ public class ProviderOrganizationsController : Controller
|
||||
providerOrganization,
|
||||
organization);
|
||||
}
|
||||
|
||||
[HttpPost("{id:guid}/delete")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
public async Task PostDelete(Guid providerId, Guid id)
|
||||
{
|
||||
await Delete(providerId, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ProviderUsersController : Controller
|
||||
}
|
||||
|
||||
[HttpGet("")]
|
||||
public async Task<ListResponseModel<ProviderUserUserDetailsResponseModel>> Get(Guid providerId)
|
||||
public async Task<ListResponseModel<ProviderUserUserDetailsResponseModel>> GetAll(Guid providerId)
|
||||
{
|
||||
if (!_currentContext.ProviderManageUsers(providerId))
|
||||
{
|
||||
@@ -155,7 +155,6 @@ public class ProviderUsersController : Controller
|
||||
}
|
||||
|
||||
[HttpPut("{id:guid}")]
|
||||
[HttpPost("{id:guid}")]
|
||||
public async Task Put(Guid providerId, Guid id, [FromBody] ProviderUserUpdateRequestModel model)
|
||||
{
|
||||
if (!_currentContext.ProviderManageUsers(providerId))
|
||||
@@ -173,8 +172,14 @@ public class ProviderUsersController : Controller
|
||||
await _providerService.SaveUserAsync(model.ToProviderUser(providerUser), userId.Value);
|
||||
}
|
||||
|
||||
[HttpPost("{id:guid}")]
|
||||
[Obsolete("This endpoint is deprecated. Use PUT method instead")]
|
||||
public async Task PostPut(Guid providerId, Guid id, [FromBody] ProviderUserUpdateRequestModel model)
|
||||
{
|
||||
await Put(providerId, id, model);
|
||||
}
|
||||
|
||||
[HttpDelete("{id:guid}")]
|
||||
[HttpPost("{id:guid}/delete")]
|
||||
public async Task Delete(Guid providerId, Guid id)
|
||||
{
|
||||
if (!_currentContext.ProviderManageUsers(providerId))
|
||||
@@ -186,8 +191,14 @@ public class ProviderUsersController : Controller
|
||||
await _providerService.DeleteUsersAsync(providerId, new[] { id }, userId.Value);
|
||||
}
|
||||
|
||||
[HttpPost("{id:guid}/delete")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
public async Task PostDelete(Guid providerId, Guid id)
|
||||
{
|
||||
await Delete(providerId, id);
|
||||
}
|
||||
|
||||
[HttpDelete("")]
|
||||
[HttpPost("delete")]
|
||||
public async Task<ListResponseModel<ProviderUserBulkResponseModel>> BulkDelete(Guid providerId, [FromBody] ProviderUserBulkRequestModel model)
|
||||
{
|
||||
if (!_currentContext.ProviderManageUsers(providerId))
|
||||
@@ -200,4 +211,11 @@ public class ProviderUsersController : Controller
|
||||
return new ListResponseModel<ProviderUserBulkResponseModel>(result.Select(r =>
|
||||
new ProviderUserBulkResponseModel(r.Item1.Id, r.Item2)));
|
||||
}
|
||||
|
||||
[HttpPost("delete")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
public async Task<ListResponseModel<ProviderUserBulkResponseModel>> PostBulkDelete(Guid providerId, [FromBody] ProviderUserBulkRequestModel model)
|
||||
{
|
||||
return await BulkDelete(providerId, model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ public class ProvidersController : Controller
|
||||
}
|
||||
|
||||
[HttpPut("{id:guid}")]
|
||||
[HttpPost("{id:guid}")]
|
||||
public async Task<ProviderResponseModel> Put(Guid id, [FromBody] ProviderUpdateRequestModel model)
|
||||
{
|
||||
if (!_currentContext.ProviderProviderAdmin(id))
|
||||
@@ -71,6 +70,13 @@ public class ProvidersController : Controller
|
||||
return new ProviderResponseModel(provider);
|
||||
}
|
||||
|
||||
[HttpPost("{id:guid}")]
|
||||
[Obsolete("This endpoint is deprecated. Use PUT method instead")]
|
||||
public async Task<ProviderResponseModel> PostPut(Guid id, [FromBody] ProviderUpdateRequestModel model)
|
||||
{
|
||||
return await Put(id, model);
|
||||
}
|
||||
|
||||
[HttpPost("{id:guid}/setup")]
|
||||
public async Task<ProviderResponseModel> Setup(Guid id, [FromBody] ProviderSetupRequestModel model)
|
||||
{
|
||||
@@ -120,7 +126,6 @@ public class ProvidersController : Controller
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
[HttpPost("{id}/delete")]
|
||||
public async Task Delete(Guid id)
|
||||
{
|
||||
if (!_currentContext.ProviderProviderAdmin(id))
|
||||
@@ -142,4 +147,11 @@ public class ProvidersController : Controller
|
||||
|
||||
await _providerService.DeleteAsync(provider);
|
||||
}
|
||||
|
||||
[HttpPost("{id}/delete")]
|
||||
[Obsolete("This endpoint is deprecated. Use DELETE method instead")]
|
||||
public async Task PostDelete(Guid id)
|
||||
{
|
||||
await Delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class OrganizationDomainControllerTests
|
||||
{
|
||||
sutProvider.GetDependency<ICurrentContext>().ManageSso(orgId).Returns(false);
|
||||
|
||||
var requestAction = async () => await sutProvider.Sut.Get(orgId);
|
||||
var requestAction = async () => await sutProvider.Sut.GetAll(orgId);
|
||||
|
||||
await Assert.ThrowsAsync<UnauthorizedAccessException>(requestAction);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class OrganizationDomainControllerTests
|
||||
sutProvider.GetDependency<ICurrentContext>().ManageSso(orgId).Returns(true);
|
||||
sutProvider.GetDependency<IOrganizationRepository>().GetByIdAsync(orgId).ReturnsNull();
|
||||
|
||||
var requestAction = async () => await sutProvider.Sut.Get(orgId);
|
||||
var requestAction = async () => await sutProvider.Sut.GetAll(orgId);
|
||||
|
||||
await Assert.ThrowsAsync<NotFoundException>(requestAction);
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class OrganizationDomainControllerTests
|
||||
}
|
||||
});
|
||||
|
||||
var result = await sutProvider.Sut.Get(orgId);
|
||||
var result = await sutProvider.Sut.GetAll(orgId);
|
||||
|
||||
Assert.IsType<ListResponseModel<OrganizationDomainResponseModel>>(result);
|
||||
Assert.Equal(orgId, result.Data.Select(x => x.OrganizationId).FirstOrDefault());
|
||||
|
||||
@@ -271,7 +271,7 @@ public class OrganizationUsersControllerTests
|
||||
SutProvider<OrganizationUsersController> sutProvider)
|
||||
{
|
||||
GetMany_Setup(organizationAbility, organizationUsers, sutProvider);
|
||||
var response = await sutProvider.Sut.Get(organizationAbility.Id, false, false);
|
||||
var response = await sutProvider.Sut.GetAll(organizationAbility.Id, false, false);
|
||||
|
||||
Assert.True(response.Data.All(r => organizationUsers.Any(ou => ou.Id == r.Id)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user