mirror of
https://github.com/bitwarden/server.git
synced 2024-11-28 13:15:12 +01:00
46 lines
1.2 KiB
Transact-SQL
46 lines
1.2 KiB
Transact-SQL
CREATE OR ALTER PROCEDURE [dbo].[AuthRequest_ReadAdminApprovalsByIds]
|
|
@OrganizationId UNIQUEIDENTIFIER,
|
|
@Ids AS [dbo].[GuidIdArray] READONLY
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
|
|
SELECT
|
|
ar.*, u.[Email], ou.[Id] AS [OrganizationUserId]
|
|
FROM
|
|
[dbo].[AuthRequestView] ar
|
|
INNER JOIN
|
|
[dbo].[OrganizationUser] ou ON ou.[UserId] = ar.[UserId] AND ou.[OrganizationId] = ar.[OrganizationId]
|
|
INNER JOIN
|
|
[dbo].[User] u ON u.[Id] = ar.[UserId]
|
|
WHERE
|
|
ar.[OrganizationId] = @OrganizationId
|
|
AND
|
|
ar.[Type] = 2 -- AdminApproval
|
|
AND
|
|
ar.[Id] IN (SELECT [Id] FROM @Ids)
|
|
END
|
|
GO
|
|
|
|
CREATE OR ALTER PROCEDURE [dbo].[AuthRequest_ReadPendingByOrganizationId]
|
|
@OrganizationId UNIQUEIDENTIFIER
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
|
|
SELECT
|
|
ar.*, u.[Email], ou.[Id] AS [OrganizationUserId]
|
|
FROM
|
|
[dbo].[AuthRequestView] ar
|
|
INNER JOIN
|
|
[dbo].[OrganizationUser] ou ON ou.[UserId] = ar.[UserId] AND ou.[OrganizationId] = ar.[OrganizationId]
|
|
INNER JOIN
|
|
[dbo].[User] u ON u.[Id] = ar.[UserId]
|
|
WHERE
|
|
ar.[OrganizationId] = @OrganizationId
|
|
AND
|
|
ar.[ResponseDate] IS NULL
|
|
AND
|
|
ar.[Type] = 2 -- AdminApproval
|
|
END
|
|
GO |