mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
4643f5960e
* move UpdateLicenseAsync from service to command * create new SelfHostedOrganizationDetails view model and move license validation logic there * move occupied seat count logic to database level
63 lines
1.4 KiB
Transact-SQL
63 lines
1.4 KiB
Transact-SQL
CREATE OR ALTER PROCEDURE [dbo].[Group_ReadCountByOrganizationId]
|
|
@OrganizationId UNIQUEIDENTIFIER
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
|
|
SELECT
|
|
COUNT(1)
|
|
FROM
|
|
[dbo].[Group]
|
|
WHERE
|
|
[OrganizationId] = @OrganizationId
|
|
END
|
|
GO
|
|
|
|
CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_ReadOccupiedSeatCountByOrganizationId]
|
|
@OrganizationId UNIQUEIDENTIFIER
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
|
|
SELECT
|
|
COUNT(1)
|
|
FROM
|
|
[dbo].[OrganizationUserView]
|
|
WHERE
|
|
OrganizationId = @OrganizationId
|
|
AND Status >= 0 --Invited
|
|
END
|
|
GO
|
|
|
|
CREATE OR ALTER PROCEDURE [dbo].[Organization_ReadByLicenseKey]
|
|
@LicenseKey VARCHAR (100)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
|
|
SELECT
|
|
*
|
|
FROM
|
|
[dbo].[OrganizationView]
|
|
WHERE
|
|
[LicenseKey] = @LicenseKey
|
|
END
|
|
GO
|
|
|
|
CREATE OR ALTER PROCEDURE [dbo].[Organization_ReadSelfHostedDetailsById]
|
|
@Id UNIQUEIDENTIFIER
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
|
|
EXEC [dbo].[Organization_ReadById] @Id
|
|
EXEC [dbo].[OrganizationUser_ReadOccupiedSeatCountByOrganizationId] @Id
|
|
EXEC [dbo].[Collection_ReadCountByOrganizationId] @Id
|
|
EXEC [dbo].[Group_ReadCountByOrganizationId] @Id
|
|
EXEC [dbo].[OrganizationUser_ReadByOrganizationId] @Id, NULL
|
|
EXEC [dbo].[Policy_ReadByOrganizationId] @Id
|
|
EXEC [dbo].[SsoConfig_ReadByOrganizationId] @Id
|
|
EXEC [dbo].[OrganizationConnection_ReadByOrganizationIdType] @Id, 2 --Scim connection type
|
|
END
|
|
GO
|