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:
@ -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>
|
@ -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
|
@ -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
|
15
src/Sql/dbo/Stored Procedures/Organization_ReadByUserId.sql
Normal file
15
src/Sql/dbo/Stored Procedures/Organization_ReadByUserId.sql
Normal 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
|
6
src/Sql/dbo/Views/OrganizationUserView.sql
Normal file
6
src/Sql/dbo/Views/OrganizationUserView.sql
Normal file
@ -0,0 +1,6 @@
|
||||
CREATE VIEW [dbo].[OrganizationUserView]
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
[dbo].[OrganizationUser]
|
6
src/Sql/dbo/Views/OrganizationView.sql
Normal file
6
src/Sql/dbo/Views/OrganizationView.sql
Normal file
@ -0,0 +1,6 @@
|
||||
CREATE VIEW [dbo].[OrganizationView]
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
[dbo].[Organization]
|
Reference in New Issue
Block a user