mirror of
https://github.com/bitwarden/server.git
synced 2025-07-05 10:02:47 -05:00
Resolve the revoke for more than one Sponsorship (#5827)
This commit is contained in:
@ -84,4 +84,16 @@ public class SelfHostedOrganizationSponsorshipsController : Controller
|
||||
|
||||
await _revokeSponsorshipCommand.RevokeSponsorshipAsync(existingOrgSponsorship);
|
||||
}
|
||||
|
||||
[HttpDelete("{sponsoringOrgId}/{sponsoredFriendlyName}/revoke")]
|
||||
public async Task AdminInitiatedRevokeSponsorshipAsync(Guid sponsoringOrgId, string sponsoredFriendlyName)
|
||||
{
|
||||
var sponsorships = await _organizationSponsorshipRepository.GetManyBySponsoringOrganizationAsync(sponsoringOrgId);
|
||||
var existingOrgSponsorship = sponsorships.FirstOrDefault(s => s.FriendlyName != null && s.FriendlyName.Equals(sponsoredFriendlyName, StringComparison.OrdinalIgnoreCase));
|
||||
if (existingOrgSponsorship == null)
|
||||
{
|
||||
throw new BadRequestException("The specified sponsored organization could not be found under the given sponsoring organization.");
|
||||
}
|
||||
await _revokeSponsorshipCommand.RevokeSponsorshipAsync(existingOrgSponsorship);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user