diff --git a/ui/src/api/system/resource-authorization.ts b/ui/src/api/system/resource-authorization.ts index a53a9d10a..dc9d3b357 100644 --- a/ui/src/api/system/resource-authorization.ts +++ b/ui/src/api/system/resource-authorization.ts @@ -5,7 +5,53 @@ import type { pageRequest } from '@/api/type/common' const prefix = '/workspace' /** - * 获取资源权限 + * 工作空间下各资源获取资源权限 + * @query 参数 + */ +const getWorkspaceResourceAuthorization: ( + workspace_id: string, + target: string, + resource: string, + page: pageRequest, + params?: any, + loading?: Ref, +) => Promise> = (workspace_id, target, resource, page, params, loading) => { + return get( + `${prefix}/${workspace_id}/resource_user_permission/resource/${target}/resource/${resource}/${page.current_page}/${page.page_size}`, + params, + loading, + ) +} + +/** + * 工作空间下各资源修改成员权限 + * @param 参数 member_id + * @param 参数 { + [ + { + "user_id": "string", + "permission": "NOT_AUTH" + } + ] + } + */ +const putWorkspaceResourceAuthorization: ( + workspace_id: string, + target: string, + resource: string, + body: any, + loading?: Ref, +) => Promise> = (workspace_id, target, resource, body, loading) => { + return put( + `${prefix}/${workspace_id}/resource_user_permission/resource/${target}/resource/${resource}`, + body, + {}, + loading, + ) +} + +/** + * 系统资源授权获取资源权限 * @query 参数 */ const getResourceAuthorization: ( @@ -24,7 +70,7 @@ const getResourceAuthorization: ( } /** - * 修改成员权限 + * 系统资源授权修改成员权限 * @param 参数 member_id * @param 参数 { [ @@ -102,4 +148,6 @@ export default { getUserList, getUserMember, getSystemFolder, + getWorkspaceResourceAuthorization, + putWorkspaceResourceAuthorization } diff --git a/ui/src/components/resource-authorization-drawer/index.vue b/ui/src/components/resource-authorization-drawer/index.vue new file mode 100644 index 000000000..aa38b2e64 --- /dev/null +++ b/ui/src/components/resource-authorization-drawer/index.vue @@ -0,0 +1,291 @@ + + + diff --git a/ui/src/enums/common.ts b/ui/src/enums/common.ts index 8510339f1..0791a235e 100644 --- a/ui/src/enums/common.ts +++ b/ui/src/enums/common.ts @@ -19,4 +19,5 @@ export enum SourceTypeEnum { KNOWLEDGE = 'KNOWLEDGE', APPLICATION = 'APPLICATION', TOOL = 'TOOL', + MODEL = 'MODEL', } diff --git a/ui/src/enums/system.ts b/ui/src/enums/system.ts index 5a4fd920d..b1e3701eb 100644 --- a/ui/src/enums/system.ts +++ b/ui/src/enums/system.ts @@ -3,10 +3,6 @@ export enum AuthorizationEnum { VIEW = 'VIEW', ROLE = 'ROLE', NOT_AUTH = 'NOT_AUTH', - KNOWLEDGE = 'KNOWLEDGE', - APPLICATION = 'APPLICATION', - MODEL = 'MODEL', - TOOL = 'TOOL', } export enum RoleTypeEnum { diff --git a/ui/src/views/application/index.vue b/ui/src/views/application/index.vue index 9044e90d3..0b0a81aa5 100644 --- a/ui/src/views/application/index.vue +++ b/ui/src/views/application/index.vue @@ -249,6 +249,14 @@ {{ $t('common.setting') }} + + + + {{ $t('views.system.resourceAuthorization.title') }} + + @@ -310,6 +322,7 @@ import CreateApplicationDialog from '@/views/application/component/CreateApplica import CreateFolderDialog from '@/components/folder-tree/CreateFolderDialog.vue' import CopyApplicationDialog from '@/views/application/component/CopyApplicationDialog.vue' import MoveToDialog from '@/components/folder-tree/MoveToDialog.vue' +import ResourceAuthorizationDrawer from '@/components/resource-authorization-drawer/index.vue' import ApplicationApi from '@/api/application/application' import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message' import useStore from '@/stores' @@ -318,7 +331,7 @@ import { useRouter, useRoute } from 'vue-router' import { isWorkFlow } from '@/utils/application' import { resetUrl } from '@/utils/common' import { dateFormat } from '@/utils/time' -import { SourceTypeEnum, ValidType, ValidCount } from '@/enums/common' +import { SourceTypeEnum } from '@/enums/common' import permissionMap from '@/permission' import WorkspaceApi from '@/api/workspace/workspace' import { hasPermission } from '@/utils/permission' @@ -358,6 +371,11 @@ const folderList = ref([]) const applicationList = ref([]) const CopyApplicationDialogRef = ref() +const ResourceAuthorizationDrawerRef = ref() +function openAuthorization(item: any) { + ResourceAuthorizationDrawerRef.value.open(item.id) +} + const MoveToDialogRef = ref() function openMoveToDialog(data: any) { diff --git a/ui/src/views/knowledge/component/KnowledgeListContainer.vue b/ui/src/views/knowledge/component/KnowledgeListContainer.vue index a1f0cf583..c3d46185d 100644 --- a/ui/src/views/knowledge/component/KnowledgeListContainer.vue +++ b/ui/src/views/knowledge/component/KnowledgeListContainer.vue @@ -258,7 +258,16 @@ {{ $t('views.shared.authorized_workspace') }} - + + + {{ $t('views.system.resourceAuthorization.title') }} + +