1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-28 13:15:12 +01:00
bitwarden-server/util/Migrator/DbScripts/2024-05-10_00_OrgUserReadManyAccountRecoveryDetailsByOrgUserIds.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
761 B
MySQL
Raw Normal View History

CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_ReadManyAccountRecoveryDetailsByOrganizationUserIds]
@OrganizationId UNIQUEIDENTIFIER,
@OrganizationUserIds AS [dbo].[GuidIdArray] READONLY
AS
BEGIN
SET NOCOUNT ON
SELECT
OU.[Id] AS OrganizationUserId,
U.[Kdf],
U.[KdfIterations],
U.[KdfMemory],
U.[KdfParallelism],
OU.[ResetPasswordKey],
O.[PrivateKey] AS EncryptedPrivateKey
FROM @OrganizationUserIds AS OUIDs
INNER JOIN [dbo].[OrganizationUser] AS OU
ON OUIDs.[Id] = OU.[Id]
INNER JOIN [dbo].[Organization] AS O
ON OU.[OrganizationId] = O.[Id]
INNER JOIN [dbo].[User] U
ON U.[Id] = OU.[UserId]
WHERE OU.[OrganizationId] = @OrganizationId
END