1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-26 12:55:17 +01:00

org user remove fixes

This commit is contained in:
Kyle Spearrin 2017-04-18 15:27:54 -04:00
parent 9746bfb236
commit 2aa7c6cfe3
2 changed files with 11 additions and 0 deletions

View File

@ -797,6 +797,11 @@ namespace Bit.Core.Services
throw new BadRequestException("User not valid.");
}
if(orgUser.UserId == deletingUserId)
{
throw new BadRequestException("You cannot remove yourself.");
}
var confirmedOwners = (await GetConfirmedOwnersAsync(organizationId)).ToList();
if(confirmedOwners.Count == 1 && confirmedOwners[0].Id == organizationUserId)
{

View File

@ -4,6 +4,12 @@ AS
BEGIN
SET NOCOUNT ON
DELETE
FROM
[dbo].[SubvaultUser]
WHERE
[OrganizationUserId] = @Id
DELETE
FROM
[dbo].[OrganizationUser]