mirror of
https://github.com/bitwarden/server.git
synced 2025-04-26 07:12:20 -05:00

* Admin initiated sponsorships now use seats similarly to inviting an organization user * Updated f4e endpoint to not expect a user ID, and instead just send a boolean * Fixed failing tests * Updated OrganizationUserReadOccupiedSeatCountByOrganizationIdQuery to ensure both left and right sides are selecting the same columns
32 lines
1.1 KiB
Transact-SQL
32 lines
1.1 KiB
Transact-SQL
-- Update OrganizationUser_ReadOccupiedSeatCountByOrganizationId to include admin-initiated sponsorships
|
|
-- Based on https://bitwarden.atlassian.net/browse/PM-17772
|
|
IF OBJECT_ID('[dbo].[OrganizationUser_ReadOccupiedSeatCountByOrganizationId]') IS NOT NULL
|
|
BEGIN
|
|
DROP PROCEDURE [dbo].[OrganizationUser_ReadOccupiedSeatCountByOrganizationId]
|
|
END
|
|
GO
|
|
|
|
CREATE PROCEDURE [dbo].[OrganizationUser_ReadOccupiedSeatCountByOrganizationId]
|
|
@OrganizationId UNIQUEIDENTIFIER
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
|
|
SELECT
|
|
(
|
|
-- Count organization users
|
|
SELECT COUNT(1)
|
|
FROM [dbo].[OrganizationUserView]
|
|
WHERE OrganizationId = @OrganizationId
|
|
AND Status >= 0 --Invited
|
|
) +
|
|
(
|
|
-- Count admin-initiated sponsorships towards the seat count
|
|
-- Introduced in https://bitwarden.atlassian.net/browse/PM-17772
|
|
SELECT COUNT(1)
|
|
FROM [dbo].[OrganizationSponsorship]
|
|
WHERE SponsoringOrganizationId = @OrganizationId
|
|
AND IsAdminInitiated = 1
|
|
)
|
|
END
|
|
GO |