This commit is contained in:
archer
2025-05-30 18:11:16 +08:00
parent ded0383ac4
commit e59816aba4
8 changed files with 35 additions and 18 deletions

View File

@@ -37,13 +37,13 @@ export const AppPermissionList: PermissionListType<AppPermissionKeyEnum> = {
name: '门户快捷应用权限',
description: '',
value: GateQuickAppPermission,
checkBoxType: 'multiple' // TODO: 加个隐藏选项
checkBoxType: 'hiden'
},
[AppPermissionKeyEnum.featuredGate]: {
name: '门户推荐应用权限',
description: '',
value: GateFeaturedAppPermission,
checkBoxType: 'multiple' // TODO: 加个隐藏选项
checkBoxType: 'hiden'
}
};

View File

@@ -11,6 +11,7 @@ export class AppPermission extends Permission {
} else if (!props?.per) {
props.per = AppDefaultPermissionVal;
}
props.permissionList = AppPermissionList;
super(props);
this.setUpdatePermissionCallback(() => {
this.hasReadPer = this.checkPer(AppPermissionList.read.value);

View File

@@ -1,5 +1,10 @@
import { type PermissionListType, type PermissionValueType } from './type';
import { PermissionList, NullPermission, OwnerPermissionVal } from './constant';
import {
PermissionList,
NullPermission,
OwnerPermissionVal,
ManagePermissionVal
} from './constant';
export type PerConstructPros = {
per?: PermissionValueType;
@@ -63,6 +68,12 @@ export class Permission {
if (perm === OwnerPermissionVal) {
return this.value === OwnerPermissionVal;
}
// 管理员
if ((this.value & ManagePermissionVal) === ManagePermissionVal) {
return (this._permissionList.manage.value & perm) === perm;
}
return (this.value & perm) === perm;
}

View File

@@ -18,7 +18,7 @@ export type PermissionListType<T = {}> = Record<
name: string;
description: string;
value: PermissionValueType;
checkBoxType: 'single' | 'multiple';
checkBoxType: 'single' | 'multiple' | 'hiden';
}
>;