1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 00:52:49 -05:00

Org API controller and supporting data access

This commit is contained in:
Kyle Spearrin
2017-03-02 00:15:05 -05:00
parent 1fed877f79
commit 0b87e2c57e
21 changed files with 405 additions and 2 deletions

View File

@ -137,5 +137,10 @@
<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\Stored Procedures\Organization_ReadByIdUserId.sql" />
<Build Include="dbo\Views\OrganizationView.sql" />
<Build Include="dbo\Views\OrganizationUserView.sql" />
<Build Include="dbo\Stored Procedures\OrganizationUser_ReadByIdUserId.sql" />
<Build Include="dbo\Stored Procedures\Organization_ReadByUserId.sql" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,15 @@
CREATE PROCEDURE [dbo].[OrganizationUser_ReadByIdUserId]
@Id UNIQUEIDENTIFIER,
@UserId UNIQUEIDENTIFIER
AS
BEGIN
SET NOCOUNT ON
SELECT
*
FROM
[dbo].[OrganizationUserView]
WHERE
[Id] = @Id
AND [UserId] = @UserId
END

View File

@ -0,0 +1,17 @@
CREATE PROCEDURE [dbo].[Organization_ReadByIdUserId]
@Id UNIQUEIDENTIFIER,
@UserId UNIQUEIDENTIFIER
AS
BEGIN
SET NOCOUNT ON
SELECT
O.*
FROM
[dbo].[OrganizationView] O
INNER JOIN
[dbo].[OrganizationUser] OU ON O.[Id] = OU.[OrganizationId]
WHERE
O.[Id] = @Id
AND OU.[UserId] = @UserId
END

View File

@ -0,0 +1,15 @@
CREATE PROCEDURE [dbo].[Organization_ReadByUserId]
@UserId UNIQUEIDENTIFIER
AS
BEGIN
SET NOCOUNT ON
SELECT
O.*
FROM
[dbo].[OrganizationView] O
INNER JOIN
[dbo].[OrganizationUser] OU ON O.[Id] = OU.[OrganizationId]
WHERE
OU.[UserId] = @UserId
END

View File

@ -0,0 +1,6 @@
CREATE VIEW [dbo].[OrganizationUserView]
AS
SELECT
*
FROM
[dbo].[OrganizationUser]

View File

@ -0,0 +1,6 @@
CREATE VIEW [dbo].[OrganizationView]
AS
SELECT
*
FROM
[dbo].[Organization]