Skip to content

Commit 135152b

Browse files
committed
feat: system other permission
1 parent 5379303 commit 135152b

3 files changed

Lines changed: 30 additions & 5 deletions

File tree

‎ui/src/layout/avatar-dropdown/index.vue‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import LoginApi from '@/api/admin/auth/login'
55
import { LOGIN_METHOD } from '@/api/enums'
66
import { useStore } from '@/stores'
77
import ChangePasswordDialog from './ChangePasswordDialog.vue'
8+
import perm from '@/permission/index.ts'
89
910
defineOptions({ name: 'AvatarDropdown' })
1011
@@ -65,17 +66,17 @@ function toUrl(url?: string) {
6566
<el-divider />
6667
<MkDropdownMenu>
6768
<!-- 修改密码 -->
68-
<MkDropdownItem @click="handleOpenChangePassword">
69+
<MkDropdownItem @click="handleOpenChangePassword" v-if="perm.system.other.changePassword()">
6970
<template #icon><MkIcon name="icon-key_outlined" /></template>
7071
<span>修改密码</span>
7172
</MkDropdownItem>
7273
<!-- // TODO API Key -->
73-
<MkDropdownItem>
74+
<MkDropdownItem v-if="perm.system.other.systemApiKey()">
7475
<template #icon><MkIcon name="icon_passkeys_outlined" /></template>
7576
<span>API Key</span>
7677
</MkDropdownItem>
7778
<!-- // TODO 语言 -->
78-
<MkDropdownItem @click.stop class="p-0!">
79+
<MkDropdownItem @click.stop class="p-0!" v-if="perm.system.other.SWITCH_LANGUAGE()">
7980
<MkDropdown class="w-full" trigger="hover" placement="left-start">
8081
<div class="flex-between w-full gap-2 p-2">
8182
<div class="flex-align-center gap-2">
@@ -113,7 +114,7 @@ function toUrl(url?: string) {
113114
<span>论坛求助</span>
114115
</MkDropdownItem>
115116
<!-- // TODO 关于 -->
116-
<MkDropdownItem>
117+
<MkDropdownItem v-if="perm.system.other.about()">
117118
<template #icon><MkIcon name="icon_info_outlined" /></template>
118119
<span>关于</span>
119120
</MkDropdownItem>

‎ui/src/permission/modules/system/index.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import appearance from './appearance'
1717
import email from './email'
1818
import operationLog from './operationLog'
1919
import homepage from './homepage'
20+
import other from './other'
2021
export default {
2122
/**
2223
* 系统「用户管理」按钮权限
@@ -73,4 +74,9 @@ export default {
7374
/**
7475
* 系统「操作日志」按钮权限
7576
*/
76-
operationLog }
77+
operationLog,
78+
/**
79+
* 系统「其他」按钮权限
80+
*/
81+
other
82+
}

‎ui/src/permission/modules/system/other.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,28 @@ import { canSys } from '../../policy'
44
import { PermissionConstants as P, hasPermission, RoleConstants, Compare} from '../../core'
55

66
export default {
7+
/**
8+
* 系统「其他/关于」关于权限
9+
*/
710
about: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.ABOUT_READ],Compare.OR),
11+
/**
12+
* 系统「其他/关于」切换语言权限
13+
*/
814
SWITCH_LANGUAGE: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.SWITCH_LANGUAGE],Compare.OR),
15+
/**
16+
* 系统「其他/关于」更新许可证权限
17+
*/
918
license: () => canSys(P.LICENSE_UPDATE),
19+
/**
20+
* 系统「其他/关于」修改密码权限
21+
*/
1022
changePassword: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.CHANGE_PASSWORD],Compare.OR),
23+
/**
24+
* 系统「其他/关于」系统APIKey权限
25+
*/
1126
systemApiKey: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.SYSTEM_API_KEY_EDIT],Compare.OR),
27+
/**
28+
* 系统「其他/关于」门户权限
29+
*/
1230
portal: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.PORTAL],Compare.OR),
1331
}

0 commit comments

Comments
 (0)