feat(auth): 添加用户权限获取接口并完善JWT令牌角色信息

- 在JWT令牌中添加用户角色信息
- 新增get_my_permissions接口用于获取当前用户权限码列表
- 重构认证回调逻辑,增加错误日志记录
- 更新用户信息获取接口使用Authorization头验证
```
This commit is contained in:
2026-04-06 00:40:08 +08:00
parent dfa8fa62a8
commit f1f8518985
71 changed files with 9402 additions and 191 deletions
+18 -3
View File
@@ -1,5 +1,6 @@
"""Celery 配置"""
from celery import Celery
from celery.schedules import crontab
from app.core.config import settings
celery_app = Celery(
@@ -12,12 +13,26 @@ celery_app.conf.update(
task_serializer='json',
result_serializer='json',
accept_content=['json'],
timezone='UTC',
timezone='Asia/Shanghai',
enable_utc=True,
# 使用专属队列,避免与同 Redis 上的其他 Celery 项目抢任务
task_default_queue='h3c_onu_ms',
beat_schedule={
'check-devices-every-30-minutes': {
# 每5分钟触发一次(最小间隔),任务内部根据配置的间隔自行节流
'check-devices-scheduler': {
'task': 'app.tasks.check_tasks.check_all_devices',
'schedule': settings.CHECK_INTERVAL,
'schedule': 300,
'options': {'queue': 'h3c_onu_ms'},
},
'aggregate-daily-snapshot': {
'task': 'app.tasks.check_tasks.aggregate_daily_snapshot',
'schedule': crontab(hour=1, minute=0), # 每天凌晨 1:00
'options': {'queue': 'h3c_onu_ms'},
},
'cleanup-audit-logs': {
'task': 'app.tasks.audit_tasks.cleanup_audit_logs_task',
'schedule': crontab(hour=2, minute=0), # 每天凌晨 2:00
'options': {'queue': 'h3c_onu_ms'},
},
},
)