appAdminRole.ts
600 Bytes
import type { UsAppMyProfileOutputDto } from '../services/usAppAuth'
/** 与后端 ReportsRoleHelper.IsAdminRole 对齐(App 管理员级联选店) */
export function isAppAdminUser(profile: UsAppMyProfileOutputDto | null | undefined): boolean {
if (!profile) return false
const code = (profile.primaryRoleCode ?? '').trim().toLowerCase()
if (code === 'admin') return true
const display = (profile.roleDisplay ?? '').trim().toLowerCase()
if (!display) return false
if (display.includes('administrator')) return true
if (display.includes('super admin')) return true
return false
}