Conversation
📝 WalkthroughWalkthroughChanged Authorization behavior so Changes
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@asab/web/auth/authorization.py`:
- Around line 182-183: The require_* methods call require_valid() and then
re-run has_*(), which can turn an intended NotAuthenticatedError into
AccessDeniedError if expiry passes between calls; change each require_* (e.g.,
require_superuser_access, require_resources) to call require_valid() first and
then invoke the underlying predicate directly instead of has_*() so no second
validity check occurs (for example call the internal predicate used by
has_superuser_access and _resources — e.g., self._has_superuser_access(...) /
self._has_resources(...) — rather than self.has_superuser_access()), and apply
the same change to the other occurrences that follow the same pattern.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b84c559e-a5ec-4178-945a-d72bbcb13e78
📒 Files selected for processing (2)
asab/web/auth/authorization.pytest/test_auth/test_authorization.py
Issue
Authorization's methodshas_resource_access,has_tenant_accessandhas_superuser_accessraiseNotAuthenticatedErrorwhen the authorization is expired. This is a rather surprising behavior; a return value ofFalsewould be more useful.Solution
Authorization.has_*_accessnow returnFalsewhen the authorization is expired. This is a potentially breaking change.Summary by CodeRabbit
Bug Fixes
Changes