1
0
mirror of https://github.com/bitwarden/server synced 2025-12-10 21:33:41 +00:00
Files
server/util/Migrator/DbScripts/2025-11-06_00_ConfirmOrgUser_AddKey.sql
Jared McCannon 4de10c830d [PM-26636] Set Key when Confirming (#6550)
* When confirming a uesr, we need to set the key. :face_palm:

* Adding default value.
2025-11-10 14:46:52 -06:00

31 lines
652 B
Transact-SQL

CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_ConfirmById]
@Id UNIQUEIDENTIFIER,
@UserId UNIQUEIDENTIFIER,
@RevisionDate DATETIME2(7),
@Key NVARCHAR(MAX) = NULL
AS
BEGIN
SET NOCOUNT ON
DECLARE @RowCount INT;
UPDATE
[dbo].[OrganizationUser]
SET
[Status] = 2, -- Set to Confirmed
[RevisionDate] = @RevisionDate,
[Key] = @Key
WHERE
[Id] = @Id
AND [Status] = 1 -- Only update if status is Accepted
SET @RowCount = @@ROWCOUNT;
IF @RowCount > 0
BEGIN
EXEC [dbo].[User_BumpAccountRevisionDate] @UserId
END
SELECT @RowCount;
END