Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion ui/src/views/model/component/ModelCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
</div>
</div>

<template #mouseEnter>
<template #mouseEnter
v-if="MoreFilledPermission(model.id)"
>
<el-dropdown trigger="click" v-if="!isShared">
<el-button text @click.stop>
<el-icon>
Expand Down Expand Up @@ -147,10 +149,21 @@ const props = defineProps<{
apiType: 'systemShare' | 'workspace' | 'systemManage'
}>()

const apiType = props.apiType

const isSystemShare = computed(() => {
return apiType==='systemShare'
})

const permissionPrecise = computed(() => {
return permissionMap['model'][props.apiType]
})

const MoreFilledPermission = (id: any) => {
return permissionPrecise.value.modify(id) ||
permissionPrecise.value.delete(id) || isSystemShare.value
}

const downModel = ref<Model>()

const currentModel = computed(() => {
Expand Down
50 changes: 21 additions & 29 deletions ui/src/views/system-chat-user/group/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
<div class="flex-between">
<span class="ellipsis" :title="row.name">{{ row.name }}</span>
<div @click.stop v-show="mouseId === row.id">
<el-dropdown :teleported="false" trigger="click">
<el-dropdown :teleported="false" trigger="click"
v-if="editPermission() || dlePermission()"
>
<el-button text>
<el-icon class="color-secondary">
<MoreFilled />
Expand All @@ -74,20 +76,7 @@
<el-dropdown-item
@click.stop="createOrUpdate(row)"
class="p-8"
v-if="
hasPermission(
new ComplexPermission(
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
[
PermissionConst.WORKSPACE_USER_GROUP_EDIT,
PermissionConst.USER_GROUP_EDIT,
],
[],
'OR',
),
'OR',
)
"
v-if="editPermission()"
>
<el-icon>
<EditPen />
Expand All @@ -97,20 +86,7 @@
<el-dropdown-item
@click.stop="deleteGroup(row)"
class="border-t p-8"
v-if="
hasPermission(
new ComplexPermission(
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
[
PermissionConst.WORKSPACE_USER_GROUP_DELETE,
PermissionConst.USER_GROUP_DELETE,
],
[],
'OR',
),
'OR',
)
"
v-if="dlePermission()"
>
<el-icon>
<Delete />
Expand Down Expand Up @@ -307,6 +283,22 @@ async function getUserGroupList() {
}
}

const editPermission = () => {
return hasPermission(new ComplexPermission(
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
[PermissionConst.WORKSPACE_USER_GROUP_EDIT,
PermissionConst.USER_GROUP_EDIT,],[],
'OR',),'OR',)
}

const dlePermission = () => {
return hasPermission(new ComplexPermission(
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
[PermissionConst.WORKSPACE_USER_GROUP_DELETE,
PermissionConst.USER_GROUP_DELETE,],[],
'OR',),'OR',)
}

onMounted(async () => {
await getUserGroupList()
current.value = list.value[0]
Expand Down
37 changes: 14 additions & 23 deletions ui/src/views/system/role/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
>({{ roleTypeMap[row.type as RoleTypeEnum] }})</span
>
</span>
<div @click.stop v-show="mouseId === row.id">
<div @click.stop v-show="mouseId === row.id"
v-if="editPermission() || delPermission()">
<el-dropdown :teleported="false" trigger="click">
<el-button text>
<el-icon class="color-secondary">
Expand All @@ -84,35 +85,15 @@
<el-dropdown-item
@click.stop="createOrUpdateRole(row)"
class="p-8"
v-if="
hasPermission(
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.ROLE_EDIT],
[],
'OR',
),
'OR',
)
"
v-if="editPermission()"
>
<el-icon><EditPen /></el-icon>
{{ $t('common.rename') }}
</el-dropdown-item>
<el-dropdown-item
@click.stop="deleteRole(row)"
class="border-t p-8"
v-if="
hasPermission(
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.ROLE_DELETE],
[],
'OR',
),
'OR',
)
"
v-if="delPermission()"
>
<el-icon><Delete /></el-icon>
{{ $t('common.delete') }}
Expand Down Expand Up @@ -205,6 +186,16 @@ async function getRole() {
}
}

const editPermission = () => {
return hasPermission(new ComplexPermission([RoleConst.ADMIN],
[PermissionConst.ROLE_EDIT],[],'OR',),'OR',)
}

const delPermission = () => {
return hasPermission(new ComplexPermission([RoleConst.ADMIN],
[PermissionConst.ROLE_DELETE],[],'OR',),'OR',)
}

onMounted(async () => {
await getRole()
currentRole.value = internalRoleList.value[0]
Expand Down
29 changes: 15 additions & 14 deletions ui/src/views/system/workspace/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
<div class="flex-between">
<span class="ellipsis" :title="row.name">{{ row.name }}</span>
<div @click.stop v-show="mouseId === row.id">
<el-dropdown :teleported="false" trigger="click">
<el-dropdown :teleported="false" trigger="click"
v-if="editPermission() || dlePermission()"
>
<el-button text>
<el-icon class="color-secondary">
<MoreFilled />
Expand All @@ -54,26 +56,15 @@
<el-dropdown-item
@click.stop="createOrUpdateWorkspace(row)"
class="p-8"
v-if="
hasPermission(
[RoleConst.ADMIN, PermissionConst.WORKSPACE_EDIT],
'OR',
)
"
v-if="editPermission()"
>
<el-icon><EditPen /></el-icon>
{{ $t('common.rename') }}
</el-dropdown-item>
<el-dropdown-item
@click.stop="deleteWorkspace(row)"
class="border-t p-8"
v-if="
row.id !== 'default' &&
hasPermission(
[RoleConst.ADMIN, PermissionConst.WORKSPACE_DELETE],
'OR',
)
"
v-if="dlePermission()"
>
<el-icon><Delete /></el-icon>
{{ $t('common.delete') }}
Expand Down Expand Up @@ -144,6 +135,16 @@ onMounted(async () => {
currentWorkspace.value = list.value[0]
})

const editPermission = () => {
return hasPermission([RoleConst.ADMIN,
PermissionConst.WORKSPACE_EDIT],'OR',)
}

const dlePermission = () => {
return hasPermission([RoleConst.ADMIN,
PermissionConst.WORKSPACE_DELETE],'OR',)
}

async function refresh(workspace?: WorkspaceItem) {
await getWorkspace()
// 创建后选中新建的
Expand Down
Loading