[Deferred] Step 2: Create admin toggle for TLG maintenance mode
> **Deferred from POC scope.** Per [feedback from @abdwdd](https://gitlab.com/gitlab-org/gitlab/-/issues/590009#note_3126470745), the POC scope was cut to essentials. For the POC, maintenance mode will be toggled via Rails console directly. This task is deferred to follow-up work post-POC.
## Summary
Provide a mechanism for administrators to toggle a TLG into and out of maintenance mode. For the POC, a Rails console command and/or Rake task is sufficient. This unblocks manual testing of all subsequent enforcement steps.
## Dependencies
- **Depends on**: Step 1 (#591688) — state machine transitions
- **Blocks**: Steps 3a (#591689), 3b (#591690), 3c (#591691) — all enforcement steps need a way to trigger maintenance mode for testing
## Context
Parent issue: https://gitlab.com/gitlab-org/gitlab/-/issues/590009
## Tasks
- [ ] Create a Rake task (e.g., `gitlab:maintenance:enable_group[group_path]` / `gitlab:maintenance:disable_group[group_path]`) that triggers the state transition
- [ ] Document Rails console usage:
```ruby
namespace = Namespace.find_by_full_path('my-group')
namespace.enter_maintenance(transition_user: User.find_by(admin: true))
# ... later ...
namespace.exit_maintenance(transition_user: User.find_by(admin: true))
```
- [ ] Add validation that only root (top-level) namespaces can be put into maintenance mode directly
- [ ] **Stretch**: Create API endpoint `PUT /api/v4/groups/:id/maintenance` with `{ "maintenance": true/false }`, gated behind admin permissions
- [ ] Add specs for the Rake task and/or API endpoint
## Effort Estimate
Small (< 1 day for Rake task, 1-2 days if API endpoint included)
task