mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
[PM-17777] sponsorships consume seats (#5694)
* 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
This commit is contained in:
@ -0,0 +1,32 @@
|
||||
-- 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
|
Reference in New Issue
Block a user