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

  1. Decorator approach — A platform_mode_disabled decorator on views.py routes returns abort(404) when PLATFORM_MODE is truthy. Placed after @login_required so auth still runs first.

  2. 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.

  3. 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.

  4. Config via app.config — Reads from app.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.

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9