Files

Host traffic R2:保留超级管理员已有监视权限

生产操作账号为启用的 superuser,但 is_staff=False。R1 的新监视 API 只接受 is_staff 导致 403;这里仅把该 API 的角色判断改为 is_staff or is_superuser。设备、会话、订阅、账号有效性检查全部保留。普通非 staff 非 superuser 仍 403,停用 superuser 仍 403。不修改任何账号角色或原有核心鉴权、profile、middleware、路由、限速、数据库 Schema。

R1 目录、源码和 manifest 不动。持久覆盖只增加本目录的 control/host_traffic.py 和 docker-compose.host-traffic-auth-r2.yml,后者叠在已部署四个 Compose 文件之后,替换唯一 /app/control/host_traffic.py 只读 bind。R1 的 URLs、store、独立 SQLite 状态目录和 startup=false 环境继续继承;保留 app UID100/GID101,不修改用户身份。

主任务核验 SHA、只上传新 R2 目录,设置代码文件 0644,再执行:

cd /opt/toplc-vpn
docker compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.shared-budget-web.yml -f /opt/toplc-vpn/host-traffic-standalone-20261106/docker-compose.host-traffic.yml -f /opt/toplc-vpn/host-traffic-standalone-20261106-r2/docker-compose.host-traffic-auth-r2.yml config --quiet
docker compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.shared-budget-web.yml -f /opt/toplc-vpn/host-traffic-standalone-20261106/docker-compose.host-traffic.yml -f /opt/toplc-vpn/host-traffic-standalone-20261106-r2/docker-compose.host-traffic-auth-r2.yml up -d --no-deps --no-build --pull never web

该命令仅重建 web,沿用已部署镜像和四文件配置,不启动任何迁移。主任务前后须核对 core source/schema/Node/RoutingPolicy/账号角色摘要、其它容器 PID/StartedAt/镜像一致;使用现有真实 token 验证 superuser 200、无 token401,返回3台真实秒级数据。不能因本地测试通过而声称生产验收完成。

本地真实 Django5.2.17 + 正式模型快照回归命令(不连服务器):

& 'output/proxy-aggregate-api-20261106/test-venv/Scripts/python.exe' 'services/toplc-vpn-platform/host-traffic-standalone-20261106-r2/tests/run_auth_regression.py'

13 项 API 安全测试包含“非 staff 超级管理员200”“普通非 staff403”“停用超级管理员403”,以及原会话到期/撤销、设备禁用、账号状态、订阅到期/配额等检查。请求中的 Django SQL 仍全部 SELECT;测试角色修改只发生于本地 SQLite fixture。

MIT source supplement: these files are published as a separate directory only. They do not replace the platform root, existing routes, source history or other licenses. Integration tests use an existing Django platform model fixture; production model snapshots, accounts, tokens, SQLite state and local output evidence are not included. Configure example endpoints for your deployment. Source publication does not assert production acceptance.

The frozen candidate manifest hashes describe original source bytes before MIT README supplements and public endpoint substitutions; SOURCE-PROVENANCE.json records both original and published hashes. The R2 API differs from frozen R1 only in allowing existing staff OR existing superuser. This source tool does not perform deployment or assert production acceptance.