diff --git a/ui/src/permission/application/system-manage.ts b/ui/src/permission/application/system-manage.ts new file mode 100644 index 00000000..c852a79f --- /dev/null +++ b/ui/src/permission/application/system-manage.ts @@ -0,0 +1,106 @@ +import {hasPermission} from '@/utils/permission/index' +import {ComplexPermission} from '@/utils/permission/type' +import {EditionConst, PermissionConst, RoleConst} from '@/utils/permission/data' + +const systemManage = { + create: () => false, + folderCreate: () => false, + edit: () => + hasPermission( + [ + RoleConst.ADMIN, + PermissionConst.RESOURCE_APPLICATION_EDIT + ], + 'OR' + ), + folderEdit: () => false, + export: () => + hasPermission( + [ + RoleConst.ADMIN, + PermissionConst.RESOURCE_APPLICATION_EXPORT + ], + 'OR' + ), + delete: () => + hasPermission( + [ + RoleConst.ADMIN, + PermissionConst.RESOURCE_APPLICATION_DELETE + ], + 'OR' + ), + folderDelete: () => false, + overview_embed: () => + hasPermission( + [ + RoleConst.ADMIN, + PermissionConst.RESOURCE_APPLICATION_OVERVIEW_EMBED + ], + 'OR' + ), + overview_access: () => + hasPermission( + [ + RoleConst.ADMIN, + PermissionConst.RESOURCE_APPLICATION_OVERVIEW_ACCESS + ], + 'OR' + ), + overview_display: () => + hasPermission( + [ + RoleConst.ADMIN, + PermissionConst.RESOURCE_APPLICATION_OVERVIEW_DISPLAY + ], + 'OR' + ), + overview_api_key: () => + hasPermission( + [ + RoleConst.ADMIN, + PermissionConst.RESOURCE_APPLICATION_OVERVIEW_API_KEY + ], + 'OR' + ), + access_edit: () => + hasPermission( + [ + RoleConst.ADMIN, + PermissionConst.RESOURCE_APPLICATION_ACCESS_EDIT + ], + 'OR' + ), + application_chat_user_edit: () => + hasPermission( + [ + RoleConst.ADMIN, + PermissionConst.RESOURCE_APPLICATION_CHAT_USER_EDIT + ], + 'OR' + ), + chat_log_clear: () => + hasPermission( + [ + RoleConst.ADMIN, + PermissionConst.RESOURCE_APPLICATION_CHAT_LOG_CLEAR_POLICY + ], + 'OR' + ), + chat_log_export: () => + hasPermission( + [ + RoleConst.ADMIN, + PermissionConst.RESOURCE_APPLICATION_CHAT_LOG_EXPORT + ], + 'OR' + ), + chat_log_add_knowledge: () => + hasPermission( + [ + RoleConst.ADMIN, + PermissionConst.RESOURCE_APPLICATION_CHAT_LOG_ADD_KNOWLEDGE + ], + 'OR' + ), +} \ No newline at end of file diff --git a/ui/src/views/system-resource-management/ToolResourceIndex.vue b/ui/src/views/system-resource-management/ToolResourceIndex.vue index 07d8c93f..548efba3 100644 --- a/ui/src/views/system-resource-management/ToolResourceIndex.vue +++ b/ui/src/views/system-resource-management/ToolResourceIndex.vue @@ -227,7 +227,9 @@ - + @@ -314,6 +316,12 @@ const permissionPrecise = computed(() => { return permissionMap['tool']['systemManage'] }) +const MoreFilledPermission = (row: any) => { + return permissionPrecise.value.export() || + permissionPrecise.value.delete() || + (row.init_field_list?.length > 0 && permissionPrecise.value.edit()) +} + function exportTool(row: any) { ToolResourceApi.exportTool(row.id, row.name, loading).catch((e: any) => { if (e.response.status !== 403) {