mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 13:38:13 -05:00
org enabeld check on user assets
This commit is contained in:
parent
c28106c81b
commit
53a25b908a
@ -14,10 +14,13 @@ BEGIN
|
||||
[dbo].[Cipher] C ON SC.[CipherId] = C.[Id]
|
||||
INNER JOIN
|
||||
[dbo].[OrganizationUser] OU ON OU.Id = SU.OrganizationUserId AND OU.OrganizationId = C.OrganizationId
|
||||
INNER JOIN
|
||||
[dbo].[Organization] O ON O.Id = C.OrganizationId
|
||||
WHERE
|
||||
C.[Id] = @CipherId
|
||||
AND OU.[UserId] = @UserId
|
||||
AND OU.[Status] = 2 -- 2 = Confirmed
|
||||
AND O.[Enabled] = 1
|
||||
)
|
||||
SELECT
|
||||
@CanEdit = CASE WHEN COUNT(1) > 0 THEN 1 ELSE 0 END
|
||||
|
@ -15,10 +15,12 @@ BEGIN
|
||||
[dbo].[SubvaultUser] SU ON SU.[SubvaultId] = SC.[SubvaultId]
|
||||
LEFT JOIN
|
||||
[dbo].[OrganizationUser] OU ON OU.[Id] = SU.[OrganizationUserId]
|
||||
LEFT JOIN
|
||||
[dbo].[Organization] O ON O.[Id] = C.[OrganizationId]
|
||||
WHERE
|
||||
C.Id = @Id
|
||||
AND (
|
||||
(C.[UserId] IS NOT NULL AND C.[UserId] = @UserId)
|
||||
OR (OU.[UserId] = @UserId AND OU.[Status] = 2) -- 2 = Confirmed
|
||||
OR (OU.[UserId] = @UserId AND OU.[Status] = 2 AND O.[Enabled] = 1) -- 2 = Confirmed
|
||||
)
|
||||
END
|
@ -15,10 +15,12 @@ BEGIN
|
||||
[dbo].[SubvaultUser] SU ON SU.[SubvaultId] = SC.[SubvaultId]
|
||||
LEFT JOIN
|
||||
[dbo].[OrganizationUser] OU ON OU.[Id] = SU.[OrganizationUserId]
|
||||
LEFT JOIN
|
||||
[dbo].[Organization] O ON O.[Id] = C.[OrganizationId]
|
||||
WHERE
|
||||
C.[Type] = @Type
|
||||
AND (
|
||||
(C.[UserId] IS NOT NULL AND C.[UserId] = @UserId)
|
||||
OR (OU.[UserId] = @UserId AND OU.[Status] = 2) -- 2 = Confirmed
|
||||
OR (OU.[UserId] = @UserId AND OU.[Status] = 2 AND O.[Enabled] = 1) -- 2 = Confirmed
|
||||
)
|
||||
END
|
@ -14,7 +14,9 @@ BEGIN
|
||||
[dbo].[SubvaultUser] SU ON SU.[SubvaultId] = SC.[SubvaultId]
|
||||
LEFT JOIN
|
||||
[dbo].[OrganizationUser] OU ON OU.[Id] = SU.[OrganizationUserId]
|
||||
LEFT JOIN
|
||||
[dbo].[Organization] O ON O.[Id] = C.[OrganizationId]
|
||||
WHERE
|
||||
(C.[UserId] IS NOT NULL AND C.[UserId] = @UserId)
|
||||
OR (OU.[UserId] = @UserId AND OU.[Status] = 2) -- 2 = Confirmed
|
||||
OR (OU.[UserId] = @UserId AND OU.[Status] = 2 AND O.[Enabled] = 1) -- 2 = Confirmed
|
||||
END
|
@ -14,7 +14,10 @@ BEGIN
|
||||
[dbo].[SubvaultUser] SU ON SU.[SubvaultId] = SC.[SubvaultId]
|
||||
INNER JOIN
|
||||
[dbo].[OrganizationUser] OU ON OU.[Id] = SU.[OrganizationUserId]
|
||||
INNER JOIN
|
||||
[dbo].[Organization] O ON O.[Id] = C.[OrganizationId]
|
||||
WHERE
|
||||
OU.[UserId] = @UserId
|
||||
AND OU.[Status] = 2 -- 2 = Confirmed
|
||||
AND O.[Enabled] = 1
|
||||
END
|
@ -19,10 +19,12 @@ BEGIN
|
||||
[dbo].[SubvaultUser] SU ON SU.[SubvaultId] = SC.[SubvaultId]
|
||||
LEFT JOIN
|
||||
[dbo].[OrganizationUser] OU ON OU.[Id] = SU.[OrganizationUserId]
|
||||
LEFT JOIN
|
||||
[dbo].[Organization] O ON O.[Id] = C.[OrganizationId]
|
||||
WHERE
|
||||
C.Id = @Id
|
||||
AND (
|
||||
(C.[UserId] IS NOT NULL AND C.[UserId] = @UserId)
|
||||
OR (OU.[UserId] = @UserId AND OU.[Status] = 2) -- 2 = Confirmed
|
||||
OR (OU.[UserId] = @UserId AND OU.[Status] = 2 AND O.[Enabled] = 1) -- 2 = Confirmed
|
||||
)
|
||||
END
|
@ -12,7 +12,10 @@ BEGIN
|
||||
[SubvaultUser] SU ON SU.[SubvaultId] = S.[Id]
|
||||
INNER JOIN
|
||||
[OrganizationUser] OU ON OU.[Id] = SU.[OrganizationUserId]
|
||||
INNER JOIN
|
||||
[Organization] O ON O.[Id] = OU.[OrganizationId]
|
||||
WHERE
|
||||
OU.[UserId] = @UserId
|
||||
AND OU.[Status] = 2 -- Confirmed
|
||||
AND O.[Enabled] = 1
|
||||
END
|
@ -4,6 +4,7 @@ SELECT
|
||||
OU.[UserId],
|
||||
OU.[OrganizationId],
|
||||
O.[Name],
|
||||
O.[Enabled],
|
||||
OU.[Key],
|
||||
OU.[Status],
|
||||
OU.[Type]
|
||||
|
Loading…
x
Reference in New Issue
Block a user