server icon indicating copy to clipboard operation
server copied to clipboard

[EC-387] User in revoked status still occupies an organization seat

Open eliykat opened this issue 3 years ago • 3 comments

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:

  1. not count revoked users towards occupied seats
  2. 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.
  • 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

Screen Shot 2022-09-09 at 1 15 46 pm Screen Shot 2022-09-09 at 1 16 51 pm

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

eliykat avatar Sep 09 '22 04:09 eliykat

Really good question @shane-melton, I hadn't thought of that. I've raised it with Product in the Jira ticket.

eliykat avatar Sep 12 '22 23:09 eliykat

@shane-melton yes, we should autoscale here, PR has been updated to do this.

eliykat avatar Sep 14 '22 00:09 eliykat

This has been sent to QA on this branch and will be merged once passed.

eliykat avatar Sep 20 '22 00:09 eliykat