mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 16:42:50 -05:00
SubvaultUser APIs and services
This commit is contained in:
@ -78,6 +78,10 @@
|
||||
<Build Include="dbo\Tables\Favorite.sql" />
|
||||
<Build Include="dbo\Tables\User.sql" />
|
||||
<Build Include="dbo\Tables\Folder.sql" />
|
||||
<Build Include="dbo\Tables\Group.sql" />
|
||||
<Build Include="dbo\Tables\GroupUser.sql" />
|
||||
<Build Include="dbo\Tables\SubvaultGroup.sql" />
|
||||
<Build Include="dbo\Views\SubvaultUserView.sql" />
|
||||
<Build Include="dbo\Views\DeviceView.sql" />
|
||||
<Build Include="dbo\Views\HistoryView.sql" />
|
||||
<Build Include="dbo\Views\CipherView.sql" />
|
||||
@ -85,6 +89,11 @@
|
||||
<Build Include="dbo\Views\OrganizationView.sql" />
|
||||
<Build Include="dbo\Views\UserView.sql" />
|
||||
<Build Include="dbo\Views\GrantView.sql" />
|
||||
<Build Include="dbo\Views\OrganizationUserOrganizationDetailsView.sql" />
|
||||
<Build Include="dbo\Views\OrganizationUserUserDetailsView.sql" />
|
||||
<Build Include="dbo\Views\SubvaultView.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Subvault_ReadByOrganizationId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\SubvaultUser_ReadByOrganizationUserId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Cipher_Create.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Cipher_DeleteById.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Favorite_Create.sql" />
|
||||
@ -142,14 +151,11 @@
|
||||
<Build Include="dbo\Stored Procedures\Grant_ReadBySubjectId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Grant_Save.sql" />
|
||||
<Build Include="dbo\Stored Procedures\User_ReadAccountRevisionDateById.sql" />
|
||||
<Build Include="dbo\Views\OrganizationUserUserDetailsView.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUserUserDetails_ReadById.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUserUserDetails_ReadByOrganizationId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\User_ReadPublicKeyById.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUserOrganizationDetails_ReadByUserId.sql" />
|
||||
<Build Include="dbo\Views\OrganizationUserOrganizationDetailsView.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUserUserDetails_ReadById.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUserUserDetails_ReadByOrganizationId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Subvault_ReadByIdAdminUserId.sql" />
|
||||
<Build Include="dbo\Views\SubvaultView.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Subvault_ReadByUserId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Subvault_ReadByOrganizationIdAdminUserId.sql" />
|
||||
</ItemGroup>
|
||||
|
@ -1,7 +1,7 @@
|
||||
CREATE PROCEDURE [dbo].[SubvaultUser_Create]
|
||||
@Id UNIQUEIDENTIFIER,
|
||||
@SubvaultId UNIQUEIDENTIFIER,
|
||||
@UserId UNIQUEIDENTIFIER,
|
||||
@OrganizationUserId UNIQUEIDENTIFIER,
|
||||
@Admin BIT,
|
||||
@ReadOnly BIT,
|
||||
@CreationDate DATETIME2(7),
|
||||
@ -14,7 +14,7 @@ BEGIN
|
||||
(
|
||||
[Id],
|
||||
[SubvaultId],
|
||||
[UserId],
|
||||
[OrganizationUserId],
|
||||
[Admin],
|
||||
[ReadOnly],
|
||||
[CreationDate],
|
||||
@ -24,7 +24,7 @@ BEGIN
|
||||
(
|
||||
@Id,
|
||||
@SubvaultId,
|
||||
@UserId,
|
||||
@OrganizationUserId,
|
||||
@Admin,
|
||||
@ReadOnly,
|
||||
@CreationDate,
|
||||
|
@ -0,0 +1,13 @@
|
||||
CREATE PROCEDURE [dbo].[SubvaultUser_ReadByOrganizationUserId]
|
||||
@OrganizationUserId UNIQUEIDENTIFIER
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
[dbo].[SubvaultUserView]
|
||||
WHERE
|
||||
[OrganizationUserId] = @OrganizationUserId
|
||||
END
|
@ -1,7 +1,7 @@
|
||||
CREATE PROCEDURE [dbo].[SubvaultUser_Update]
|
||||
@Id UNIQUEIDENTIFIER,
|
||||
@SubvaultId UNIQUEIDENTIFIER,
|
||||
@UserId UNIQUEIDENTIFIER,
|
||||
@OrganizationUserId UNIQUEIDENTIFIER,
|
||||
@Key VARCHAR(MAX),
|
||||
@Admin BIT,
|
||||
@ReadOnly BIT,
|
||||
@ -15,7 +15,7 @@ BEGIN
|
||||
[dbo].[SubvaultUser]
|
||||
SET
|
||||
[SubvaultId] = @SubvaultId,
|
||||
[UserId] = @UserId,
|
||||
[OrganizationUserId] = @OrganizationUserId,
|
||||
[Admin] = @Admin,
|
||||
[ReadOnly] = @ReadOnly,
|
||||
[CreationDate] = @CreationDate,
|
||||
|
@ -0,0 +1,13 @@
|
||||
CREATE PROCEDURE [dbo].[Subvault_ReadByOrganizationId]
|
||||
@OrganizationId UNIQUEIDENTIFIER
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT
|
||||
S.*
|
||||
FROM
|
||||
[dbo].[SubvaultView] S
|
||||
WHERE
|
||||
S.[OrganizationId] = @OrganizationId
|
||||
END
|
@ -10,6 +10,8 @@ BEGIN
|
||||
[dbo].[SubvaultView] S
|
||||
INNER JOIN
|
||||
[SubvaultUser] SU ON SU.[SubvaultId] = S.[Id]
|
||||
INNER JOIN
|
||||
[OrganizationUser] OU ON SU.[OrganizationUserId] = OU.[Id]
|
||||
WHERE
|
||||
SU.[UserId] = @UserId
|
||||
OU.[UserId] = @UserId
|
||||
END
|
10
src/Sql/dbo/Tables/Group.sql
Normal file
10
src/Sql/dbo/Tables/Group.sql
Normal file
@ -0,0 +1,10 @@
|
||||
CREATE TABLE [dbo].[Group] (
|
||||
[Id] UNIQUEIDENTIFIER NOT NULL,
|
||||
[OrganizationId] UNIQUEIDENTIFIER NOT NULL,
|
||||
[Name] NVARCHAR (50) NOT NULL,
|
||||
[CreationDate] DATETIME NOT NULL,
|
||||
[RevisionDate] DATETIME NOT NULL,
|
||||
CONSTRAINT [PK_Group] PRIMARY KEY CLUSTERED ([Id] ASC),
|
||||
CONSTRAINT [FK_Group_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id])
|
||||
);
|
||||
|
8
src/Sql/dbo/Tables/GroupUser.sql
Normal file
8
src/Sql/dbo/Tables/GroupUser.sql
Normal file
@ -0,0 +1,8 @@
|
||||
CREATE TABLE [dbo].[GroupUser] (
|
||||
[GroupId] UNIQUEIDENTIFIER NOT NULL,
|
||||
[UserId] UNIQUEIDENTIFIER NOT NULL,
|
||||
CONSTRAINT [PK_GroupUser] PRIMARY KEY CLUSTERED ([GroupId] ASC, [UserId] ASC),
|
||||
CONSTRAINT [FK_GroupUser_Group] FOREIGN KEY ([GroupId]) REFERENCES [dbo].[Group] ([Id]),
|
||||
CONSTRAINT [FK_GroupUser_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id])
|
||||
);
|
||||
|
8
src/Sql/dbo/Tables/SubvaultGroup.sql
Normal file
8
src/Sql/dbo/Tables/SubvaultGroup.sql
Normal file
@ -0,0 +1,8 @@
|
||||
CREATE TABLE [dbo].[SubvaultGroup] (
|
||||
[SubvaultId] UNIQUEIDENTIFIER NOT NULL,
|
||||
[GroupId] UNIQUEIDENTIFIER NOT NULL,
|
||||
CONSTRAINT [PK_SubvaultGroup] PRIMARY KEY CLUSTERED ([SubvaultId] ASC, [GroupId] ASC),
|
||||
CONSTRAINT [FK_SubvaultGroup_Group] FOREIGN KEY ([GroupId]) REFERENCES [dbo].[Group] ([Id]),
|
||||
CONSTRAINT [FK_SubvaultGroup_Subvault] FOREIGN KEY ([SubvaultId]) REFERENCES [dbo].[Subvault] ([Id])
|
||||
);
|
||||
|
@ -1,13 +1,13 @@
|
||||
CREATE TABLE [dbo].[SubvaultUser] (
|
||||
[Id] UNIQUEIDENTIFIER NOT NULL,
|
||||
[SubvaultId] UNIQUEIDENTIFIER NOT NULL,
|
||||
[UserId] UNIQUEIDENTIFIER NOT NULL,
|
||||
[Admin] BIT NOT NULL,
|
||||
[ReadOnly] BIT NOT NULL,
|
||||
[CreationDate] DATETIME2 (7) NOT NULL,
|
||||
[RevisionDate] DATETIME2 (7) NOT NULL,
|
||||
[Id] UNIQUEIDENTIFIER NOT NULL,
|
||||
[SubvaultId] UNIQUEIDENTIFIER NOT NULL,
|
||||
[OrganizationUserId] UNIQUEIDENTIFIER NOT NULL,
|
||||
[Admin] BIT NOT NULL,
|
||||
[ReadOnly] BIT NOT NULL,
|
||||
[CreationDate] DATETIME2 (7) NOT NULL,
|
||||
[RevisionDate] DATETIME2 (7) NOT NULL,
|
||||
CONSTRAINT [PK_SubvaultUser] PRIMARY KEY CLUSTERED ([Id] ASC),
|
||||
CONSTRAINT [FK_SubvaultUser_Subvault] FOREIGN KEY ([SubvaultId]) REFERENCES [dbo].[Subvault] ([Id]),
|
||||
CONSTRAINT [FK_SubvaultUser_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id])
|
||||
CONSTRAINT [FK_SubvaultUser_OrganizationUser] FOREIGN KEY ([OrganizationUserId]) REFERENCES [dbo].[OrganizationUser] ([Id]),
|
||||
CONSTRAINT [FK_SubvaultUser_Subvault] FOREIGN KEY ([SubvaultId]) REFERENCES [dbo].[Subvault] ([Id])
|
||||
);
|
||||
|
||||
|
6
src/Sql/dbo/Views/SubvaultUserView.sql
Normal file
6
src/Sql/dbo/Views/SubvaultUserView.sql
Normal file
@ -0,0 +1,6 @@
|
||||
CREATE VIEW [dbo].[SubvaultUserView]
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
[dbo].[SubvaultUser]
|
@ -3,4 +3,4 @@ AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
[dbo].[Subvault]
|
||||
[dbo].[Subvault]
|
Reference in New Issue
Block a user