mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[PM-10319] - Revoke Non Complaint Users for 2FA and Single Org Policy Enablement (#5037)
- Revoking users when enabling single org and 2fa policies. - Updated emails sent when users are revoked via 2FA or Single Organization policy enablement Co-authored-by: Matt Bishop <mbishop@bitwarden.com> Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
This commit is contained in:
@ -0,0 +1,28 @@
|
||||
CREATE PROCEDURE [dbo].[OrganizationUser_SetStatusForUsersById]
|
||||
@OrganizationUserIds AS NVARCHAR(MAX),
|
||||
@Status SMALLINT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
-- Declare a table variable to hold the parsed JSON data
|
||||
DECLARE @ParsedIds TABLE (Id UNIQUEIDENTIFIER);
|
||||
|
||||
-- Parse the JSON input into the table variable
|
||||
INSERT INTO @ParsedIds (Id)
|
||||
SELECT value
|
||||
FROM OPENJSON(@OrganizationUserIds);
|
||||
|
||||
-- Check if the input table is empty
|
||||
IF (SELECT COUNT(1) FROM @ParsedIds) < 1
|
||||
BEGIN
|
||||
RETURN(-1);
|
||||
END
|
||||
|
||||
UPDATE
|
||||
[dbo].[OrganizationUser]
|
||||
SET [Status] = @Status
|
||||
WHERE [Id] IN (SELECT Id from @ParsedIds)
|
||||
|
||||
EXEC [dbo].[User_BumpAccountRevisionDateByOrganizationUserIds] @OrganizationUserIds
|
||||
END
|
Reference in New Issue
Block a user