mirror of
https://github.com/bitwarden/server.git
synced 2025-07-17 07:30:59 -05:00
added groups apis
This commit is contained in:
@ -178,5 +178,11 @@
|
||||
<Build Include="dbo\User Defined Types\GuidIdArray.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_ReadCountByOrganizationOwnerUser.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Cipher_ReadCanEditByIdUserId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Group_Create.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Group_DeleteById.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Group_ReadById.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Group_ReadByOrganizationId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Group_Update.sql" />
|
||||
<Build Include="dbo\Views\GroupView.sql" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -5,9 +5,9 @@ BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT
|
||||
S.*
|
||||
*
|
||||
FROM
|
||||
[dbo].[CollectionView] S
|
||||
[dbo].[CollectionView]
|
||||
WHERE
|
||||
S.[OrganizationId] = @OrganizationId
|
||||
[OrganizationId] = @OrganizationId
|
||||
END
|
@ -5,15 +5,15 @@ BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT
|
||||
S.*
|
||||
C.*
|
||||
FROM
|
||||
[dbo].[CollectionView] S
|
||||
[dbo].[CollectionView] C
|
||||
INNER JOIN
|
||||
[Organization] O ON O.[Id] = S.[OrganizationId]
|
||||
[Organization] O ON O.[Id] = C.[OrganizationId]
|
||||
INNER JOIN
|
||||
[dbo].[OrganizationUser] OU ON OU.[OrganizationId] = O.[Id] AND OU.[UserId] = @UserId
|
||||
LEFT JOIN
|
||||
[dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[CollectionId] = S.[Id] AND CU.[OrganizationUserId] = OU.[Id]
|
||||
[dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[CollectionId] = C.[Id] AND CU.[OrganizationUserId] = OU.[Id]
|
||||
WHERE
|
||||
OU.[Status] = 2 -- Confirmed
|
||||
AND O.[Enabled] = 1
|
||||
|
27
src/Sql/dbo/Stored Procedures/Group_Create.sql
Normal file
27
src/Sql/dbo/Stored Procedures/Group_Create.sql
Normal file
@ -0,0 +1,27 @@
|
||||
CREATE PROCEDURE [dbo].[Group_Create]
|
||||
@Id UNIQUEIDENTIFIER,
|
||||
@OrganizationId UNIQUEIDENTIFIER,
|
||||
@Name VARCHAR(MAX),
|
||||
@CreationDate DATETIME2(7),
|
||||
@RevisionDate DATETIME2(7)
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
INSERT INTO [dbo].[Group]
|
||||
(
|
||||
[Id],
|
||||
[OrganizationId],
|
||||
[Name],
|
||||
[CreationDate],
|
||||
[RevisionDate]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@Id,
|
||||
@OrganizationId,
|
||||
@Name,
|
||||
@CreationDate,
|
||||
@RevisionDate
|
||||
)
|
||||
END
|
12
src/Sql/dbo/Stored Procedures/Group_DeleteById.sql
Normal file
12
src/Sql/dbo/Stored Procedures/Group_DeleteById.sql
Normal file
@ -0,0 +1,12 @@
|
||||
CREATE PROCEDURE [dbo].[Group_DeleteById]
|
||||
@Id UNIQUEIDENTIFIER
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
DELETE
|
||||
FROM
|
||||
[dbo].[Group]
|
||||
WHERE
|
||||
[Id] = @Id
|
||||
END
|
13
src/Sql/dbo/Stored Procedures/Group_ReadById.sql
Normal file
13
src/Sql/dbo/Stored Procedures/Group_ReadById.sql
Normal file
@ -0,0 +1,13 @@
|
||||
CREATE PROCEDURE [dbo].[Group_ReadById]
|
||||
@Id UNIQUEIDENTIFIER
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
[dbo].[GroupView]
|
||||
WHERE
|
||||
[Id] = @Id
|
||||
END
|
13
src/Sql/dbo/Stored Procedures/Group_ReadByOrganizationId.sql
Normal file
13
src/Sql/dbo/Stored Procedures/Group_ReadByOrganizationId.sql
Normal file
@ -0,0 +1,13 @@
|
||||
CREATE PROCEDURE [dbo].[Group_ReadByOrganizationId]
|
||||
@OrganizationId UNIQUEIDENTIFIER
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
[dbo].[GroupView]
|
||||
WHERE
|
||||
[OrganizationId] = @OrganizationId
|
||||
END
|
20
src/Sql/dbo/Stored Procedures/Group_Update.sql
Normal file
20
src/Sql/dbo/Stored Procedures/Group_Update.sql
Normal file
@ -0,0 +1,20 @@
|
||||
CREATE PROCEDURE [dbo].[Group_Update]
|
||||
@Id UNIQUEIDENTIFIER,
|
||||
@OrganizationId UNIQUEIDENTIFIER,
|
||||
@Name VARCHAR(MAX),
|
||||
@CreationDate DATETIME2(7),
|
||||
@RevisionDate DATETIME2(7)
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
UPDATE
|
||||
[dbo].[Group]
|
||||
SET
|
||||
[OrganizationId] = @OrganizationId,
|
||||
[Name] = @Name,
|
||||
[CreationDate] = @CreationDate,
|
||||
[RevisionDate] = @RevisionDate
|
||||
WHERE
|
||||
[Id] = @Id
|
||||
END
|
6
src/Sql/dbo/Views/GroupView.sql
Normal file
6
src/Sql/dbo/Views/GroupView.sql
Normal file
@ -0,0 +1,6 @@
|
||||
CREATE VIEW [dbo].[GroupView]
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
[dbo].[Group]
|
Reference in New Issue
Block a user