Step 2: Rails controller enforcement for Organization read-only mode
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Create an EnforcesReadOnlyOrganization concern following the EnforcesStepUpAuthenticationForNamespace pattern to block write requests when an Organization is in :maintenance state.
Branch from: duo-edit-20260307-155643 (!226399 (closed) - Step 1 POC branch)
Implementation Details
- Create
app/controllers/concerns/enforces_read_only_organization.rb - Include in
Groups::ApplicationControllerwithbefore_actionafter@groupis loaded - Include in
Projects::ApplicationControllerwithbefore_actionafter@projectis loaded - Resolve Organization from loaded group/project via
namespace.organization - Check if Organization is in
:maintenancestate - Write requests: return 503 (JSON) or redirect with flash (HTML)
- Read requests: allow through
Key Files
-
app/controllers/concerns/enforces_read_only_organization.rb(new) app/controllers/groups/application_controller.rbapp/controllers/projects/application_controller.rb
Reference Pattern
app/controllers/concerns/enforces_step_up_authentication_for_namespace.rb
Effort
Medium (2-3 days)
Dependencies
- Step 1 (Organization state machine) - done via !226399 (closed)
Edited by 🤖 GitLab Bot 🤖