Properties
category: reference tags: - p2 - otterwiki - platform-mode last_updated: 2026-03-13
P2-8: Admin Panel Hiding
Status: Complete
Acceptance Criteria
- With
PLATFORM_MODE=True: disabled sections hidden from nav, routes return 404 - With
PLATFORM_MODE=false(or unset): all sections visible (backward compatible) - Enabled sections (Application Preferences, Sidebar Preferences, Content and Editing) work normally in both modes
- Existing test suite passes (325 tests + 8 new = 333 total)
Files Changed
| File | Change |
|---|---|
otterwiki/server.py |
Added PLATFORM_MODE=False to default config |
otterwiki/templates/settings.html |
Wrapped 4 disabled nav items in {% if not config.PLATFORM_MODE %} block |
otterwiki/views.py |
Added platform_mode_disabled decorator; applied to 5 routes |
tests/test_platform_mode.py |
New: 8 tests covering both modes |
Design Decisions
Decorator approach — A
platform_mode_disableddecorator on views.py routes returnsabort(404)whenPLATFORM_MODEis truthy. Placed after@login_requiredso auth still runs first.Five routes disabled — The 4 specified admin sections plus
/-/user/<uid>(individual user editing), which is part of User Management and would be inconsistent to leave exposed.Template conditional — Single
{% if not config.PLATFORM_MODE %}block wraps all 4 disabled nav links. The block is inside the existing{% if has_permission("ADMIN") %}guard, so it only affects admin users.Config via
app.config— Reads fromapp.config.get("PLATFORM_MODE")so it can be set via environment variable, settings file, or programmatically in tests.
Test Results
- Before: 325 passed
- After: 333 passed (8 new tests)
- New tests cover: GET/POST 404 on disabled routes, 200 on enabled routes, nav item visibility in both modes, user edit route blocking
Branch
feat/P2-8-admin-panel-hiding based on wikibot-io — not pushed.