Files
HSAP/vendor/cvat/patches/no_auth_middleware.py
Chengfang Lu 672ef61e17 feat: CVAT 标注引擎、我的标注收件箱与 ADAS Cuboid 送标
- 统一标注引擎为 CVAT:客户端/配置/格式转换、iframe 标注页、docker-compose.cvat.yml 与 no_auth 补丁
- 移除 Label Studio 相关配置与构建脚本,清理 embedded.bak 备份与误提交的 node_modules
- 新增「我的标注」:跨 Campaign 收件箱、逐张清单、CVAT frame 跳转
- 飞书任务分配:通讯录同步选人、按量分配、分配后 DM 通知(含 my-tasks 链接)
- ADAS cuboid_7cls 数据湖接入:workflow 路径、register-batch、开标上传与标注同步
- 数据湖挂载 AS_DATA_LAKE_ROOT、datasets/adas 符号链接、reset_labeling 运维脚本
- 补充 docs/HANDOVER.md 项目交接文档

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-15 17:25:28 +08:00

33 lines
1007 B
Python

"""
Auto-authenticate all requests as a default admin user.
This removes the need for login in local/test environments.
"""
from django.conf import settings
from django.contrib.auth import get_user_model
User = get_user_model()
class NoAuthMiddleware:
"""Middleware that auto-authenticates every request as the first superuser."""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
# Only set user if not already authenticated
if not request.user.is_authenticated:
try:
user = User.objects.filter(is_superuser=True).first()
if not user:
user = User.objects.create_superuser(
username="auto",
email="auto@local.dev",
password="auto",
)
request.user = user
except Exception:
pass
return self.get_response(request)