Merge branch 'dev' into order-delivery-reply
# Conflicts: # backend/app/models/user.py # docs/demand.md # docs/funclist.md # frontend/src/features/auth/stores/auth.store.ts # dev existing problems
This commit is contained in:
commit
821bd0a62c
101 files changed
+4784
-527
No files matched your search
@@ -18,6 +18,8 @@ export interface AuthUser {
|
||||
real_name?: string;
|
||||
employee_id?: string;
|
||||
role?: string;
|
||||
role_name?: string;
|
||||
is_platform_admin?: boolean;
|
||||
feature_permissions?: FeaturePermissions;
|
||||
token?: string;
|
||||
access_token?: string;
|
||||
@@ -26,6 +28,17 @@ export interface AuthUser {
|
||||
token_expires_at?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否平台管理员。优先读后端 is_platform_admin;旧登录态缺字段时回退 role=admin。
|
||||
*/
|
||||
export function isPlatformAdminUser(
|
||||
user?: { is_platform_admin?: boolean; role?: string } | null,
|
||||
): boolean {
|
||||
if (!user) return false;
|
||||
if (typeof user.is_platform_admin === 'boolean') return user.is_platform_admin;
|
||||
return String(user.role || '').trim().toLowerCase() === 'admin';
|
||||
}
|
||||
|
||||
interface StoredAuthPayload {
|
||||
user?: AuthUser;
|
||||
expiry?: number;
|
||||
|
||||
Reference in new issue
Block a user