feat: Resource tool permission
This commit is contained in:
parent
f13dcbcc3c
commit
53f83d3292
106
ui/src/permission/application/system-manage.ts
Normal file
106
ui/src/permission/application/system-manage.ts
Normal file
@ -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'
|
||||||
|
),
|
||||||
|
}
|
||||||
@ -227,7 +227,9 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click"
|
||||||
|
v-if="MoreFilledPermission(row)"
|
||||||
|
>
|
||||||
<el-button text @click.stop>
|
<el-button text @click.stop>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<MoreFilled />
|
<MoreFilled />
|
||||||
@ -314,6 +316,12 @@ const permissionPrecise = computed(() => {
|
|||||||
return permissionMap['tool']['systemManage']
|
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) {
|
function exportTool(row: any) {
|
||||||
ToolResourceApi.exportTool(row.id, row.name, loading).catch((e: any) => {
|
ToolResourceApi.exportTool(row.id, row.name, loading).catch((e: any) => {
|
||||||
if (e.response.status !== 403) {
|
if (e.response.status !== 403) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user