feat: add rbac-backed settings modules

This commit is contained in:
wren
2026-04-29 22:25:06 +08:00
parent b3ad4a6f33
commit 3a58f19d6c
23 changed files with 2979 additions and 7 deletions
@@ -18,6 +18,11 @@ from fastapi_modules.fastapi_leaudit.services.authService import IAuthService
class AuthServiceImpl(IAuthService):
"""认证服务实现。"""
@staticmethod
def _naive_utcnow() -> datetime:
"""返回适配 timestamp without time zone 的 UTC 时间。"""
return datetime.utcnow()
async def PasswordLogin(self, Sub: str, Password: str) -> LoginTokenVO:
"""账密登录。
@@ -112,7 +117,7 @@ class AuthServiceImpl(IAuthService):
"ou_id": OuId or user.get("ou_id") or "",
"ou_name": OuName or user.get("ou_name") or "",
"is_leader": IsLeader if IsLeader is not None else user.get("is_leader"),
"now": datetime.now(timezone.utc),
"now": self._naive_utcnow(),
"id": user["id"],
},
)
@@ -133,7 +138,7 @@ class AuthServiceImpl(IAuthService):
"ou_id": OuId or "",
"ou_name": OuName or "",
"is_leader": bool(IsLeader),
"now": datetime.now(timezone.utc),
"now": self._naive_utcnow(),
},
)
user_id = created.scalar_one()