mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-14 07:00:47 +00:00

* refactor: permission role * refactor: permission type * fix: permission manage * fix: group owner cannot be deleted * chore: common per map * chore: openapi * chore: rename * fix: type error * chore: app chat log permission * chore: add initv4112
26 lines
804 B
TypeScript
26 lines
804 B
TypeScript
import { type PerConstructPros, Permission } from '../controller';
|
|
import { AppDefaultRoleVal, AppPerList, AppRoleList, AppRolePerMap } from './constant';
|
|
|
|
export class AppPermission extends Permission {
|
|
hasReadChatLogPer: boolean = false;
|
|
hasReadChatLogRole: boolean = false;
|
|
constructor(props?: PerConstructPros) {
|
|
if (!props) {
|
|
props = {
|
|
role: AppDefaultRoleVal
|
|
};
|
|
} else if (!props?.role) {
|
|
props.role = AppDefaultRoleVal;
|
|
}
|
|
props.roleList = AppRoleList;
|
|
props.rolePerMap = AppRolePerMap;
|
|
props.perList = AppPerList;
|
|
super(props);
|
|
|
|
this.setUpdatePermissionCallback(() => {
|
|
this.hasReadChatLogPer = this.checkPer(AppPerList.readChatLog);
|
|
this.hasReadChatLogRole = this.checkRole(AppRoleList.readChatLog.value);
|
|
});
|
|
}
|
|
}
|