Removed the `getAdminReportRebateCommission` function and its references from the admin reports API and localization files. Updated CSS for improved money display handling in admin components. Enhanced localization support by adding new finance and support workspace entries in English, Nepali, and Chinese, improving user experience across the application.
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
/** 当前登录管理员是否拥有 `required` 中任一权限(与 Laravel `prd.*` slug 对齐)。 */
|
||
export function adminHasAnyPermission(
|
||
permissionSlugs: readonly string[] | null | undefined,
|
||
required: readonly string[],
|
||
): boolean {
|
||
const set = permissionSlugs ?? [];
|
||
if (set.length === 0 || required.length === 0) {
|
||
return false;
|
||
}
|
||
return required.some((slug) => set.includes(slug));
|
||
}
|
||
|
||
/** 当前登录管理员是否拥有 `required` 中任一 action code(与 API 鉴权 / `operational_permissions` 对齐)。 */
|
||
export function adminHasAnyPermissionCode(
|
||
permissionCodes: readonly string[] | null | undefined,
|
||
required: readonly string[],
|
||
): boolean {
|
||
const set = permissionCodes ?? [];
|
||
if (set.length === 0 || required.length === 0) {
|
||
return false;
|
||
}
|
||
return required.some((code) => set.includes(code));
|
||
}
|
||
|
||
/** 读取会话中的 operational_permissions;旧缓存无该字段时回退到 permissions(兼容发版前 localStorage)。 */
|
||
export function adminOperationalPermissionCodes(
|
||
profile: { operational_permissions?: string[]; permissions?: string[] } | null | undefined,
|
||
): readonly string[] {
|
||
if (Array.isArray(profile?.operational_permissions) && profile.operational_permissions.length > 0) {
|
||
return profile.operational_permissions;
|
||
}
|
||
return profile?.permissions ?? [];
|
||
}
|