feat: completely remove domain from RoleManager when calling DeleteDomains#1496
feat: completely remove domain from RoleManager when calling DeleteDomains#1496hsluoyz merged 1 commit intoapache:masterfrom D0000M:master
Conversation
|
@oppiliappan plz review |
|
@tangyang9464 plz review |
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the DeleteDomains method to remove all related policies and role manager entries when domains are deleted, adds synchronization support, updates the interface, implements domain deletion in the default role manager, and introduces tests for the new behavior.
- Expand
Enforcer.DeleteDomainsto loop through all domains, remove filtered policies, and clear role manager entries - Add
DeleteDomainstoSyncedEnforcerand to theRoleManagerinterface/implementations - Create tests in
rbac_api_with_domains_test.gocovering domain deletion scenarios
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| rbac_api_with_domains.go | Updated DeleteDomains logic to remove policies and clean up role manager |
| rbac_api_with_domains_synced.go | Added DeleteDomains wrapper to SyncedEnforcer |
| rbac_api_with_domains_test.go | Added TestDeleteDomains and helper to verify domain deletions |
| rbac/role_manager.go | Introduced DeleteDomain to the RoleManager interface |
| rbac/default-role-manager/role_manager.go | Implemented DeleteDomain in the default role managers |
| model_test.go | Stubbed DeleteDomain on custom test role manager |
Comments suppressed due to low confidence (2)
rbac_api_with_domains_test.go:303
- The test ignores both the boolean result and the error from
DeleteDomains. Add assertions to verifyokis true anderris nil before checking policies.
_, _ = e.DeleteDomains(domains...)
rbac_api_with_domains.go:147
- [nitpick] Consider making the comment imperative (e.g.,
// DeleteDomains deletes all associated policies and grouping policies and cleans up the role manager) to better reflect the implemented behavior.
// DeleteDomains would delete all associated policies.
|
@D0000M The key problem of this issue #1492 is that |
|
🎉 This PR is included in version 2.109.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
close #1492
The original
DeleteDomains()only performed the task ofDeleteAllUsersByDomain(), but nowDeleteDomains()will delete all associated policies as well.