feat(auth): 停用账密登录 + 扫码会话有效期下发 + 叠加制身份模型
- /auth/login 全端口停用(403 引导手机号/小程序扫码登录) - 扫码会话接口下发 expires_in(前端二维码倒计时) - role_allowed 叠加制身份:所有账号自带 OPC 基础身份,operator/carrier 仅业务叠加,35 处 C 端端点统一放行
This commit is contained in:
+8
-1
@@ -17,7 +17,14 @@ def is_platform_admin(user: dict) -> bool:
|
||||
|
||||
|
||||
def role_allowed(user: dict, *roles: str) -> bool:
|
||||
"""当前用户业务角色是否 ∈ 允许角色集合。"""
|
||||
"""当前用户业务角色是否 ∈ 允许角色集合。
|
||||
|
||||
身份模型(叠加制,非割裂):每个账号都自带「OPC 基础身份」——运营方(operator)、
|
||||
载体方(carrier) 等只是在其上的业务角色叠加。因此凡要求 opc_member 的能力
|
||||
(C 端通用能力:浏览/点赞/留言/报名/接单…),任意登录账号均具备。
|
||||
"""
|
||||
if "opc_member" in roles:
|
||||
return True
|
||||
return user.get("role") in set(roles)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user