mirror of
https://github.com/bitwarden/server.git
synced 2025-07-13 13:47:30 -05:00
apis for managing collection users
This commit is contained in:
@ -160,7 +160,7 @@
|
||||
<Build Include="dbo\Stored Procedures\User_ReadById.sql" />
|
||||
<Build Include="dbo\Stored Procedures\CollectionUser_Delete.sql" />
|
||||
<Build Include="dbo\Stored Procedures\User_Update.sql" />
|
||||
<Build Include="dbo\Stored Procedures\CollectionUserDetails_ReadByCollectionId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\CollectionUser_ReadByCollectionId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Group_Create.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Group_CreateWithCollections.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Group_DeleteById.sql" />
|
||||
@ -236,6 +236,6 @@
|
||||
<Build Include="dbo\Stored Procedures\Collection_ReadByIdUserId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Collection_ReadWithGroupsByIdUserId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Collection_CreateWithGroups.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Collection_UpdateUsers.sql" />
|
||||
<Build Include="dbo\Stored Procedures\CollectionUser_UpdateUsers.sql" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,42 +0,0 @@
|
||||
CREATE PROCEDURE [dbo].[CollectionUserDetails_ReadByCollectionId]
|
||||
@CollectionId UNIQUEIDENTIFIER,
|
||||
@OrganizationId UNIQUEIDENTIFIER
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT
|
||||
OU.[Id] AS [OrganizationUserId],
|
||||
CASE
|
||||
WHEN OU.[AccessAll] = 1 OR G.[AccessAll] = 1 THEN 1
|
||||
ELSE 0
|
||||
END [AccessAll],
|
||||
U.[Name],
|
||||
ISNULL(U.[Email], OU.[Email]) Email,
|
||||
OU.[Status],
|
||||
OU.[Type],
|
||||
CASE
|
||||
WHEN OU.[AccessAll] = 1 OR CU.[ReadOnly] = 0 OR G.[AccessAll] = 1 OR CG.[ReadOnly] = 0 THEN 0
|
||||
ELSE 1
|
||||
END [ReadOnly]
|
||||
FROM
|
||||
[dbo].[OrganizationUser] OU
|
||||
LEFT JOIN
|
||||
[dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[OrganizationUserId] = OU.[Id] AND CU.[CollectionId] = @CollectionId
|
||||
LEFT JOIN
|
||||
[dbo].[GroupUser] GU ON CU.[CollectionId] IS NULL AND OU.[AccessAll] = 0 AND GU.[OrganizationUserId] = OU.[Id]
|
||||
LEFT JOIN
|
||||
[dbo].[Group] G ON G.[Id] = GU.[GroupId]
|
||||
LEFT JOIN
|
||||
[dbo].[CollectionGroup] CG ON G.[AccessAll] = 0 AND CG.[GroupId] = GU.[GroupId] AND CG.[CollectionId] = @CollectionId
|
||||
LEFT JOIN
|
||||
[dbo].[User] U ON U.[Id] = OU.[UserId]
|
||||
WHERE
|
||||
OU.[OrganizationId] = @OrganizationId
|
||||
AND (
|
||||
CU.[CollectionId] IS NOT NULL
|
||||
OR CG.[CollectionId] IS NOT NULL
|
||||
OR OU.[AccessAll] = 1
|
||||
OR G.[AccessAll] = 1
|
||||
)
|
||||
END
|
@ -0,0 +1,14 @@
|
||||
CREATE PROCEDURE [dbo].[CollectionUser_ReadByCollectionId]
|
||||
@CollectionId UNIQUEIDENTIFIER
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT
|
||||
[OrganizationUserId] [Id],
|
||||
[ReadOnly]
|
||||
FROM
|
||||
[dbo].[CollectionUser]
|
||||
WHERE
|
||||
[CollectionId] = @CollectionId
|
||||
END
|
@ -1,4 +1,4 @@
|
||||
CREATE PROCEDURE [dbo].[Collection_UpdateUsers]
|
||||
CREATE PROCEDURE [dbo].[CollectionUser_UpdateUsers]
|
||||
@Id UNIQUEIDENTIFIER,
|
||||
@Users AS [dbo].[SelectionReadOnlyArray] READONLY
|
||||
AS
|
Reference in New Issue
Block a user