mirror of
https://github.com/bitwarden/server.git
synced 2026-06-01 01:55:55 -05:00
* Initial pass of revocation reason * 2'nd pass, with tests, of revocation reason * separate migration concerns, begin using new bulk sprocs * remove old RevokeManyByIdAsync in favor of RevokeManyAsync * fix migrations order * Adjust other missing sprocs * begrudgingly formats file * No longer drop now-deprecated sprocs * Add more views to refresh * re-adds stored procs * formatting from restoration * Fix naming * Modify sproc file name to match name
46 lines
1.1 KiB
Transact-SQL
46 lines
1.1 KiB
Transact-SQL
-- Create OrganizationUser_RevokeMany
|
|
CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_RevokeMany]
|
|
@OrganizationUserIds AS [dbo].[GuidIdArray] READONLY,
|
|
@RevocationReason TINYINT = NULL
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
|
|
UPDATE
|
|
OU
|
|
SET
|
|
OU.[Status] = -1, -- Revoked
|
|
OU.[RevocationReason] = @RevocationReason
|
|
FROM
|
|
[dbo].[OrganizationUser] OU
|
|
INNER JOIN
|
|
@OrganizationUserIds OUI ON OUI.[Id] = OU.[Id]
|
|
|
|
EXEC [dbo].[User_BumpAccountRevisionDateByOrganizationUserIds] @OrganizationUserIds
|
|
END
|
|
GO
|
|
|
|
-- Create OrganizationUser_RestoreMany
|
|
CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_RestoreMany]
|
|
@OrganizationUserIds AS [dbo].[GuidIdArray] READONLY,
|
|
@Status SMALLINT
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
|
|
UPDATE
|
|
OU
|
|
SET
|
|
OU.[Status] = @Status,
|
|
OU.[RevocationReason] = NULL
|
|
FROM
|
|
[dbo].[OrganizationUser] OU
|
|
INNER JOIN
|
|
@OrganizationUserIds OUI ON OUI.[Id] = OU.[Id]
|
|
WHERE
|
|
OU.[Status] = -1 -- Only restore currently revoked users
|
|
|
|
EXEC [dbo].[User_BumpAccountRevisionDateByOrganizationUserIds] @OrganizationUserIds
|
|
END
|
|
GO
|