[PM-37486] Remove IPolicyService and associated dead code#7672
Conversation
…pendency and replace with IPolicyRequirementQuery for policy checks. Update related tests to reflect changes in policy validation logic.
…Service with IPolicyRequirementQuery for policy checks. Update tests accordingly to reflect changes in policy validation logic.
…updating PolicyServiceCollectionExtensions and deleting associated tests. This change streamlines policy management by relying on IPolicyRequirementQuery for policy checks.
…tailsAsync method and associated tests.
…icyDetails and PolicyDetails_ReadByUserId, as they are no longer called in the codebase.
Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR completes the migration from the legacy Prior reviewer concerns are addressed: the orphaned Code Review DetailsNo new findings. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7672 +/- ##
==========================================
+ Coverage 60.43% 64.82% +4.38%
==========================================
Files 2140 2138 -2
Lines 94622 94507 -115
Branches 8443 8440 -3
==========================================
+ Hits 57188 61262 +4074
+ Misses 35429 31151 -4278
- Partials 2005 2094 +89 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…es, as they are no longer needed in the codebase.
…licyRequirementQuery for SSO validation checks. Update related test logic to ensure accurate policy validation outcomes. Clean up unused test fixtures in PolicyFixtures.cs to streamline the codebase.
…ability by storing policy requirement results in local variables before returning values. This change enhances code clarity while maintaining existing functionality.
…of the policy requirement query in a local variable before returning the enforced options. This change enhances code readability while preserving existing functionality.
| -- OrganizationUser_ReadByUserIdWithPolicyDetails was used by PolicyService (now deleted). | ||
| -- PolicyDetails_ReadByUserId was never called anywhere. | ||
|
|
||
| DROP PROCEDURE IF EXISTS [dbo].[OrganizationUser_ReadByUserIdWithPolicyDetails]; |
There was a problem hiding this comment.
It looks like the C# code that calls this proc is being removed in this PR. If the deployment requires a server code rollback, this DROP would cause issues since DB changes are not reverted. This DROP should be moved to another PR to be done at a later date once this server deployment is hardened.
There was a problem hiding this comment.
Thanks for calling this out! I have reverted the SQL changes in this branch. I will create a separate task to drop the stored procedures in a future release.
…dWithPolicyDetails and PolicyDetails_ReadByUserId, as they are no longer called in the codebase." This reverts commit 0f4fdca.
…-sprocs # Conflicts: # src/Identity/IdentityServer/RequestValidators/SsoRequestValidator.cs
|
JaredSnider-Bitwarden
left a comment
There was a problem hiding this comment.
These changes LGTM!
The expected behavior is intended to be the same but since this isn't feature flagged, I would like to request the following flows be QA tested from an auth perspective:
-
Login master-password policy — log in as a member of an org with the Master Password policy configured; confirm the client picks up the correct rules on the direct login response. Repeat for a user in two orgs with conflicting settings — strictest values should win.
-
/accounts/verify-passwordreprompt - As the same user, perform any master-password reprompt action (Export vault is easiest); confirm the client receives the same policy block. Also verify a user in no org can successfully hit this endpoint and gets a default/empty policy block (no 500). -
Accept org invite under Single Org policy
- User already
Confirmedin Org A (Single Org policy ON) must be blocked from accepting Org B's invite. - User only
Invited(not yetAccepted) in Org A must still be able to accept Org B's invite. - User
Revokedin Org A must be able to accept Org B's invite. - Provider-exempt user must be able to accept.
I take it this is the change in
Same as above.
This has not been changed here. Maybe you're looking at the Let me know if I've missed or misunderstood anything. |
@eliykat |



🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-37486
📔 Objective
Migrate remaining
IPolicyServicecallers to useIPolicyRequirementQueryand subsequently delete `IPolicyService.