server
server copied to clipboard
[EC-387] User in revoked status still occupies an organization seat
Type of change
- [x] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other
Objective
Currently a revoked user still occupies a seat. We need to:
- not count revoked users towards occupied seats
- check that when a revoked user is restored, there are enough seats
Code changes
General changes:
-
src/Core/Models/Data/Organizations/OrganizationUsers/OrganizationUserUserDetails.cs - create new getter for
OccupiesOrganizationSeat, which is false for revoked users -
src/Core/Services/Implementations/OrganizationService.cs
- create new method
GetOccupiedSeatCount, which excludes revoked users in the count - update all existing seat checks to use this method
- add new checks in the restoreUser/s methods to make sure enough seats are available before restoring. Note that if doing a bulk restore, we won't restore anyone if there aren't enough seats for everyone, this is intentional.
- create new method
- bitwarden_license/src/Sso/Controllers/AccountController.cs - update seat check to use new method
Admin portal changes:
- src/Admin/Models/OrganizationViewModel.cs - update the view model to use the new count method. This ensures that revoked users are not counted in the totals shown in the admin portal (per product/design requirements).
Screenshots

Before you submit
- Please check for formatting errors (
dotnet format --verify-no-changes) (required) - If making database changes - make sure you also update Entity Framework queries and/or migrations
- Please add unit tests where it makes sense to do so (encouraged but not required)
- If this change requires a documentation update - notify the documentation team
- If this change has particular deployment requirements - notify the DevOps team
Really good question @shane-melton, I hadn't thought of that. I've raised it with Product in the Jira ticket.
@shane-melton yes, we should autoscale here, PR has been updated to do this.
This has been sent to QA on this branch and will be merged once passed.