mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[Key Connector] Prevent user from leaving org (#1715)
* Block user from leaving org using Key Connector * Add tests
This commit is contained in:
@ -384,6 +384,12 @@ namespace Bit.Api.Controllers
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
var ssoConfig = await _ssoConfigRepository.GetByOrganizationIdAsync(orgGuidId);
|
||||
if (ssoConfig?.GetData()?.UseKeyConnector == true)
|
||||
{
|
||||
throw new BadRequestException("You cannot leave an Organization that is using Key Connector.");
|
||||
}
|
||||
|
||||
var userId = _userService.GetProperUserId(User);
|
||||
await _organizationService.DeleteUserAsync(orgGuidId, userId.Value);
|
||||
}
|
||||
|
Reference in New Issue
Block a user