AAP-45047: Fix allow map to process grant case in create_claims#959
AAP-45047: Fix allow map to process grant case in create_claims#959web3dozie wants to merge 1 commit intoansible:develfrom
Conversation
The allow map type only handled the deny case (has_permission=False). When a trigger fired and has_permission=True, the code fell through to the catch-all else branch, logging "does not know how to be processed" and never setting access_allowed back to True. This broke the documented deny-all + allow-override pattern (the AAP 2.5+ equivalent of AUTH_LDAP_REQUIRE_GROUP). Fixes: AAP-45047, AAP-45394
|
DVCS PR Check Results: PR appears valid (JIRA key(s) found) |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe pull request modifies the authentication access control logic for 'allow' type maps, changing from conditionally updating access only when permission is False to always setting access_allowed based on the map's permission result. Comprehensive regression tests are added to cover allow/deny map interactions and edge cases. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
create_claims()function inclaims.pynow correctly handlesmap_type=allowwhen the trigger fires (has_permission=True), allowing a later allow map to override an earlier deny.has_permission=False). When a trigger fired andhas_permission=True, the code fell through to the catch-all else branch, logging "does not know how to be processed" and never settingaccess_allowed = True. This broke the documented deny-all + allow-override pattern.if auth_map.map_type == 'allow' and not has_permission:toif auth_map.map_type == 'allow':and setsaccess_allowed = has_permission. This handles both grant and deny cases and respects map ordering (later maps override earlier ones).Fixes: AAP-45047, AAP-45394
Type of Change
Self-Review Checklist
Testing Instructions
Prerequisites
Any authenticator (LDAP or Local Database).
Steps to Test
Expected Results
Before this fix
ERROR Map type allow of rule Allow Override does not know how to be processedWARNING User <username> failed an allow map and was denied accessSummary by CodeRabbit
Bug Fixes
Tests