1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-07 02:52:50 -05:00

EC-262 - implement org user deactivated flag and behavior server (#2050)

* SM-47 - Add Disabled status to enum + schema

* SM-47 - Enable and disable sprocs and repositories

* SM-47 - Organization service enble/disable user

* SM-47 - Fix lint errors

* SM-47 - add disable/enable endpoints to API

* SM-47 - Add bulk operations for enable/disable

* SM-47 - Fix linting errors, one of these days I'll do this first

* SM-47 - Codesense fix DRY warnings

* EC-262 - Code review changes, async cleanup

* EC-262 - Fix build issues, async refs

* EC-262 - Update controller param types

* EC-262 - Ensure mutable state is correct

* EC-262 - rename disabled to deactivated
This commit is contained in:
Chad Scharf
2022-06-16 15:59:57 -04:00
committed by GitHub
parent 8e79c20dce
commit b2a0aa2860
25 changed files with 2507 additions and 13 deletions

View File

@ -122,6 +122,8 @@
<Build Include="dbo\Stored Procedures\Grant_DeleteByKey.sql" />
<Build Include="dbo\Stored Procedures\OrganizationUser_DeleteById.sql" />
<Build Include="dbo\Stored Procedures\OrganizationUser_DeleteByIds.sql" />
<Build Include="dbo\Stored Procedures\OrganizationUser_Deactivate.sql" />
<Build Include="dbo\Stored Procedures\OrganizationUser_Activate.sql" />
<Build Include="dbo\Stored Procedures\Grant_Delete.sql" />
<Build Include="dbo\Stored Procedures\OrganizationUser_ReadById.sql" />
<Build Include="dbo\Stored Procedures\OrganizationUser_ReadByIds.sql" />

View File

@ -2,7 +2,7 @@ CREATE FUNCTION [dbo].[PolicyApplicableToUser]
(
@UserId UNIQUEIDENTIFIER,
@PolicyType TINYINT,
@MinimumStatus TINYINT
@MinimumStatus SMALLINT
)
RETURNS TABLE
AS RETURN

View File

@ -1,6 +1,6 @@
CREATE PROCEDURE [dbo].[OrganizationUserOrganizationDetails_ReadByUserIdStatus]
@UserId UNIQUEIDENTIFIER,
@Status TINYINT
@Status SMALLINT
AS
BEGIN
SET NOCOUNT ON

View File

@ -1,6 +1,6 @@
CREATE PROCEDURE [dbo].[OrganizationUserOrganizationDetails_ReadByUserIdStatusOrganizationId]
@UserId UNIQUEIDENTIFIER,
@Status TINYINT,
@Status SMALLINT,
@OrganizationId UNIQUEIDENTIFIER
AS
BEGIN

View File

@ -0,0 +1,17 @@
CREATE PROCEDURE [dbo].[OrganizationUser_Activate]
@Id UNIQUEIDENTIFIER,
@Status SMALLINT
AS
BEGIN
SET NOCOUNT ON
UPDATE
[dbo].[OrganizationUser]
SET
[Status] = @Status
WHERE
[Id] = @Id
AND [Status] = -1 -- Deactivated
EXEC [dbo].[User_BumpAccountRevisionDateByOrganizationUserId] @Id
END

View File

@ -4,7 +4,7 @@
@UserId UNIQUEIDENTIFIER,
@Email NVARCHAR(256),
@Key VARCHAR(MAX),
@Status TINYINT,
@Status SMALLINT,
@Type TINYINT,
@AccessAll BIT,
@ExternalId NVARCHAR(300),

View File

@ -4,7 +4,7 @@
@UserId UNIQUEIDENTIFIER,
@Email NVARCHAR(256),
@Key VARCHAR(MAX),
@Status TINYINT,
@Status SMALLINT,
@Type TINYINT,
@AccessAll BIT,
@ExternalId NVARCHAR(300),

View File

@ -0,0 +1,15 @@
CREATE PROCEDURE [dbo].[OrganizationUser_Deactivate]
@Id UNIQUEIDENTIFIER
AS
BEGIN
SET NOCOUNT ON
UPDATE
[dbo].[OrganizationUser]
SET
[Status] = -1 -- Deactivated
WHERE
[Id] = @Id
EXEC [dbo].[User_BumpAccountRevisionDateByOrganizationUserId] @Id
END

View File

@ -4,7 +4,7 @@
@UserId UNIQUEIDENTIFIER,
@Email NVARCHAR(256),
@Key VARCHAR(MAX),
@Status TINYINT,
@Status SMALLINT,
@Type TINYINT,
@AccessAll BIT,
@ExternalId NVARCHAR(300),

View File

@ -4,7 +4,7 @@
@UserId UNIQUEIDENTIFIER,
@Email NVARCHAR(256),
@Key VARCHAR(MAX),
@Status TINYINT,
@Status SMALLINT,
@Type TINYINT,
@AccessAll BIT,
@ExternalId NVARCHAR(300),

View File

@ -5,7 +5,7 @@
[Email] NVARCHAR (256) NULL,
[Key] VARCHAR (MAX) NULL,
[ResetPasswordKey] VARCHAR (MAX) NULL,
[Status] TINYINT NOT NULL,
[Status] SMALLINT NOT NULL,
[Type] TINYINT NOT NULL,
[AccessAll] BIT NOT NULL,
[ExternalId] NVARCHAR (300) NULL,

View File

@ -4,7 +4,7 @@ CREATE TYPE [dbo].[OrganizationUserType] AS TABLE(
[UserId] UNIQUEIDENTIFIER,
[Email] NVARCHAR(256),
[Key] VARCHAR(MAX),
[Status] TINYINT,
[Status] SMALLINT,
[Type] TINYINT,
[AccessAll] BIT,
[ExternalId] NVARCHAR(300),