Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Replace super_user checks with action policies

This PR replaces all direct current_user&.super_user? checks with appropriate action policy calls.

Changes Plan:

  • Understand current codebase structure and policy framework
  • Create/update admin-related policy methods where needed
    • Updated ReportPolicy to include organization membership check with nil safety
    • Updated EventPolicy to include owner check for edit
    • Updated OrganizationPolicy to properly scope active organizations for admins
  • Replace current_user&.super_user? in controllers with policy-based authorization
    • EventsController: Removed redundant check (using policy's edit? method)
    • MonthlyReportsController: Removed redundant check, fixed error message
    • PeopleController: Use authorized_scope for Organization
    • QuotesController: Use authorized_scope for Workshop
    • WorkshopLogsController: Use authorized_scope for User and Workshop
  • Replace user&.super_user? in services with appropriate policy checks
    • WorkshopSearchService: Removed unused admin flag (authorization is handled by controller)
  • Replace current_user&.super_user? in views with allowed_to? helper calls
    • Created current_user_admin? helper for general admin checks in views
    • Replaced 110+ occurrences with appropriate policy calls or helper
    • Fixed syntax errors from automated replacement
    • Kept legitimate uses of super_user attribute (form inputs, data display)
  • Run tests to ensure no functionality is broken
  • Code review and security scan
Original prompt

replace all current_user&.super_user? (or current_user.super_user or user.super_user) with calls to relevant action policies


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits February 9, 2026 18:46
…vices

Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants