feat: About permission
parent
887de56877
commit
4648f08f98
|
|
@ -178,6 +178,7 @@ class Operate(Enum):
|
||||||
AUTH = "READ+AUTH" # 资源授权
|
AUTH = "READ+AUTH" # 资源授权
|
||||||
TAG = "READ+TAG" # 标签设置
|
TAG = "READ+TAG" # 标签设置
|
||||||
REPLACE = "READ+REPLACE" # 标签设置
|
REPLACE = "READ+REPLACE" # 标签设置
|
||||||
|
UPDATE = "READ+UPDATE" # 更新license
|
||||||
|
|
||||||
|
|
||||||
class RoleGroup(Enum):
|
class RoleGroup(Enum):
|
||||||
|
|
@ -1014,9 +1015,14 @@ class PermissionConstants(Enum):
|
||||||
)
|
)
|
||||||
|
|
||||||
ABOUT_READ = Permission(group=Group.OTHER, operate=Operate.READ,
|
ABOUT_READ = Permission(group=Group.OTHER, operate=Operate.READ,
|
||||||
|
role_list=[RoleConstants.ADMIN, RoleConstants.USER],
|
||||||
|
parent_group=[SystemGroup.OTHER, WorkspaceGroup.OTHER, UserGroup.OTHER],
|
||||||
|
label=_('About')
|
||||||
|
)
|
||||||
|
ABOUT_UPDATE = Permission(group=Group.OTHER, operate=Operate.UPDATE,
|
||||||
role_list=[RoleConstants.ADMIN],
|
role_list=[RoleConstants.ADMIN],
|
||||||
parent_group=[SystemGroup.OTHER],
|
parent_group=[SystemGroup.OTHER],
|
||||||
label=_('About')
|
label=_('Update License')
|
||||||
)
|
)
|
||||||
SWITCH_LANGUAGE = Permission(group=Group.OTHER, operate=Operate.EDIT,
|
SWITCH_LANGUAGE = Permission(group=Group.OTHER, operate=Operate.EDIT,
|
||||||
role_list=[RoleConstants.ADMIN, RoleConstants.USER],
|
role_list=[RoleConstants.ADMIN, RoleConstants.USER],
|
||||||
|
|
|
||||||
|
|
@ -8743,3 +8743,6 @@ msgstr ""
|
||||||
|
|
||||||
msgid "Replace Original Document"
|
msgid "Replace Original Document"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Update License"
|
||||||
|
msgstr ""
|
||||||
|
|
@ -8869,3 +8869,6 @@ msgstr "下载原文档"
|
||||||
|
|
||||||
msgid "Replace Original Document"
|
msgid "Replace Original Document"
|
||||||
msgstr "替换原文档"
|
msgstr "替换原文档"
|
||||||
|
|
||||||
|
msgid "Update License"
|
||||||
|
msgstr "更新许可证"
|
||||||
|
|
@ -8869,3 +8869,6 @@ msgstr "下載原文件"
|
||||||
|
|
||||||
msgid "Replace Original Document"
|
msgid "Replace Original Document"
|
||||||
msgstr "替換原文件"
|
msgstr "替換原文件"
|
||||||
|
|
||||||
|
msgid "Update License"
|
||||||
|
msgstr "更新許可證"
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,10 @@
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:on-change="onChange"
|
:on-change="onChange"
|
||||||
v-hasPermission="new Role('ADMIN')"
|
v-if="hasPermission([
|
||||||
|
RoleConst.ADMIN,
|
||||||
|
PermissionConst.ABOUT_UPDATE
|
||||||
|
],'OR')"
|
||||||
>
|
>
|
||||||
<el-button class="border-primary mr-16"
|
<el-button class="border-primary mr-16"
|
||||||
>{{ $t('layout.about.update') }} License
|
>{{ $t('layout.about.update') }} License
|
||||||
|
|
@ -70,6 +73,8 @@ import {fromNowDate} from '@/utils/time'
|
||||||
import {Role} from '@/utils/permission/type'
|
import {Role} from '@/utils/permission/type'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
|
import { hasPermission } from '@/utils/permission'
|
||||||
|
import { PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||||
const {user, theme} = useStore()
|
const {user, theme} = useStore()
|
||||||
const isDefaultTheme = computed(() => {
|
const isDefaultTheme = computed(() => {
|
||||||
return theme.isDefaultTheme()
|
return theme.isDefaultTheme()
|
||||||
|
|
|
||||||
|
|
@ -320,6 +320,7 @@ const PermissionConst = {
|
||||||
OPERATION_LOG_CLEAR_POLICY: new Permission('OPERATION_LOG:READ+CLEAR_POLICY'),
|
OPERATION_LOG_CLEAR_POLICY: new Permission('OPERATION_LOG:READ+CLEAR_POLICY'),
|
||||||
|
|
||||||
ABOUT_READ: new Permission('OTHER:READ'),
|
ABOUT_READ: new Permission('OTHER:READ'),
|
||||||
|
ABOUT_UPDATE: new Permission('OTHER:READ+UPDATE'),
|
||||||
SWITCH_LANGUAGE: new Permission('OTHER:READ+EDIT'),
|
SWITCH_LANGUAGE: new Permission('OTHER:READ+EDIT'),
|
||||||
CHANGE_PASSWORD: new Permission('OTHER:READ+CREATE'),
|
CHANGE_PASSWORD: new Permission('OTHER:READ+CREATE'),
|
||||||
SYSTEM_API_KEY_EDIT: new Permission('OTHER:READ+DELETE'),
|
SYSTEM_API_KEY_EDIT: new Permission('OTHER:READ+DELETE'),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue