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
9 changes: 5 additions & 4 deletions ui/src/layout/avatar-dropdown/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import LoginApi from '@/api/admin/auth/login'
import { LOGIN_METHOD } from '@/api/enums'
import { useStore } from '@/stores'
import ChangePasswordDialog from './ChangePasswordDialog.vue'
import perm from '@/permission/index.ts'

defineOptions({ name: 'AvatarDropdown' })

Expand Down Expand Up @@ -65,17 +66,17 @@ function toUrl(url?: string) {
<el-divider />
<MkDropdownMenu>
<!-- 修改密码 -->
<MkDropdownItem @click="handleOpenChangePassword">
<MkDropdownItem @click="handleOpenChangePassword" v-if="perm.system.other.changePassword()">
<template #icon><MkIcon name="icon-key_outlined" /></template>
<span>修改密码</span>
</MkDropdownItem>
<!-- // TODO API Key -->
<MkDropdownItem>
<MkDropdownItem v-if="perm.system.other.systemApiKey()">
<template #icon><MkIcon name="icon_passkeys_outlined" /></template>
<span>API Key</span>
</MkDropdownItem>
<!-- // TODO 语言 -->
<MkDropdownItem @click.stop class="p-0!">
<MkDropdownItem @click.stop class="p-0!" v-if="perm.system.other.SWITCH_LANGUAGE()">
<MkDropdown class="w-full" trigger="hover" placement="left-start">
<div class="flex-between w-full gap-2 p-2">
<div class="flex-align-center gap-2">
Expand Down Expand Up @@ -113,7 +114,7 @@ function toUrl(url?: string) {
<span>论坛求助</span>
</MkDropdownItem>
<!-- // TODO 关于 -->
<MkDropdownItem>
<MkDropdownItem v-if="perm.system.other.about()">
<template #icon><MkIcon name="icon_info_outlined" /></template>
<span>关于</span>
</MkDropdownItem>
Expand Down
8 changes: 7 additions & 1 deletion ui/src/permission/modules/system/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import appearance from './appearance'
import email from './email'
import operationLog from './operationLog'
import homepage from './homepage'
import other from './other'
export default {
/**
* 系统「用户管理」按钮权限
Expand Down Expand Up @@ -73,4 +74,9 @@ export default {
/**
* 系统「操作日志」按钮权限
*/
operationLog }
operationLog,
/**
* 系统「其他」按钮权限
*/
other
}
18 changes: 18 additions & 0 deletions ui/src/permission/modules/system/other.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,28 @@ import { canSys } from '../../policy'
import { PermissionConstants as P, hasPermission, RoleConstants, Compare} from '../../core'

export default {
/**
* 系统「其他/关于」关于权限
*/
about: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.ABOUT_READ],Compare.OR),
/**
* 系统「其他/关于」切换语言权限
*/
SWITCH_LANGUAGE: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.SWITCH_LANGUAGE],Compare.OR),
/**
* 系统「其他/关于」更新许可证权限
*/
license: () => canSys(P.LICENSE_UPDATE),
/**
* 系统「其他/关于」修改密码权限
*/
changePassword: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.CHANGE_PASSWORD],Compare.OR),
/**
* 系统「其他/关于」系统APIKey权限
*/
systemApiKey: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.SYSTEM_API_KEY_EDIT],Compare.OR),
/**
* 系统「其他/关于」门户权限
*/
portal: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.PORTAL],Compare.OR),
}
Loading