fix: dashboard admins can drill into any review from /admin/reviews #51
No reviewers
Labels
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
brooktrails/pr-reviewer!51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/admin-can-view-all-reviews"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The /admin/reviews list landed in #49 but every clickthrough 403'd
because the review-detail and rate handlers gated on
canUserSeeReview, which only lets the PR author or a requested
reviewer through. Admins viewing the cross-system list could see
that a review existed but never open it — inconsistent and
actionably broken.
Add an isAdmin parameter to canUserSeeReview that short-circuits the
involvement check, and a small sessionIsAdmin(r) helper so the two
existing call sites (review-detail GET and rate POST) can derive it
from request context. Behaviour for non-admins is unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
Automated review by pr-reviewer v0.21.0 | Full Review | Claude Sonnet 4 | tracking id
r-f48187-094f8bThis is an AI-generated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: Approve — The fix correctly addresses the access control inconsistency for admin users with clean implementation and proper security considerations.
Complexity: trivial
Code Review
Summary
This PR fixes a legitimate access control bug where dashboard admins could see review listings in
/admin/reviewsbut couldn't actually view individual reviews due to overly restrictive permission checks. The solution is clean and maintains security boundaries appropriately.What's Good ✅
Correct Problem Identification: The issue description accurately identifies the inconsistency - admins had a system-wide review list but couldn't drill down into individual reviews, which is broken UX.
Clean Implementation:
sessionIsAdmin(r)helper is well-designed and reusableisAdminparameter tocanUserSeeReviewis the right approachcanUserSeeReviewmaintains clean control flowSecurity Considerations:
s.cfg.AdminGroup)Documentation: The updated comment on
canUserSeeReviewclearly explains the admin bypass logic and provides good context about the broader access control design.Implementation Details
The changes are minimal and focused:
canUserSeeReviewnow takes anisAdmin boolparametertrueifisAdminis setsessionIsAdmin()extracts admin check logic for reusehandleReviewDetailandhandleRateReviewnow pass the admin flagArchitecture Alignment
This aligns well with the existing two-tier system mentioned in the project guidance - admins have elevated access to system-wide data, and this fix ensures that access is consistent across both listing and detail views.
Minor Observations
admin_handlers.gowhere admins have broader accessConclusion
This is a straightforward bug fix that resolves a real usability issue for admin users while maintaining proper security boundaries. The implementation is clean, well-documented, and follows existing patterns in the codebase.
📚 Context used in this review
Project guidance files:
CLAUDE.mdRepository fragments:
internal/dashboard/admin_handlers.go(internal/dashboard/admin_handlers.go:15-45) — extracted in answer to: "admin access patterns, admin group checking, and any existing admin review functionality"