From 2c65e894556fb89409c1e3179f361e54a3129d6b Mon Sep 17 00:00:00 2001 From: "Weiwei.Mo" Date: Fri, 12 Aug 2022 18:46:26 +0800 Subject: [PATCH] fix: fix role (#92) Signed-off-by: moweiwei Signed-off-by: moweiwei --- src/core/menu.js | 4 ++-- src/locales/basezh.json | 12 +++++++++++- .../containers/BackupPoint/actions/Create.jsx | 2 +- .../containers/BackupPoint/actions/Delete.jsx | 2 +- .../cluster/containers/BackupPoint/actions/Edit.jsx | 2 +- .../containers/Cluster/actions/LinkAddPlugin.jsx | 2 +- .../containers/Cluster/actions/LinkAddStorage.jsx | 2 +- .../cluster/containers/Cluster/actions/Terminal.jsx | 2 ++ .../cluster/containers/LocalRegistry/actions/Add.jsx | 2 +- .../containers/LocalRegistry/actions/Delete.jsx | 2 +- 10 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/core/menu.js b/src/core/menu.js index a63329f8..549e16df 100644 --- a/src/core/menu.js +++ b/src/core/menu.js @@ -73,7 +73,7 @@ const renderMenu = (t) => { name: t('BackupPoint'), key: 'backup-point', level: 1, - module: 'clusters', + module: 'backuppoints', }, { path: '/cluster/template', @@ -117,7 +117,7 @@ const renderMenu = (t) => { name: t('LocalRegistry'), key: '/cluster/local-registry', level: 1, - module: 'clusters', + module: 'registries', }, ], }, diff --git a/src/locales/basezh.json b/src/locales/basezh.json index 9a315f8f..57f82124 100644 --- a/src/locales/basezh.json +++ b/src/locales/basezh.json @@ -65,5 +65,15 @@ "DNS Delete": "删除 DNS", "DNS_DELETE_DESC": "删除 DNS 解析", "DNS Create": "创建 DNS", - "DNS_CREATE_DESC": "创建 DNS 解析" + "DNS_CREATE_DESC": "创建 DNS 解析", + "Registry View": "查看镜像仓库", + "REGISTRY_VIEW_DESC": "查看平台镜像仓库", + "Registry Edit": "编辑镜像仓库", + "REGISTRY_EDIT_DESC": "编辑平台镜像仓库", + "Cluster Access": "访问 Kubectl", + "CLUSTER_ACCESS_DESC": "连接终端访问 kubectl console", + "BackupPoint View": "查看备份点", + "BACKUPPOINT_VIEW_DESC": "查看集群备份点", + "BackupPoint Edit": "编辑备份点", + "BACKUPPOINT_EDIT_DESC": "编辑集群备份点" } diff --git a/src/pages/cluster/containers/BackupPoint/actions/Create.jsx b/src/pages/cluster/containers/BackupPoint/actions/Create.jsx index 5ba23ae0..ec41c455 100644 --- a/src/pages/cluster/containers/BackupPoint/actions/Create.jsx +++ b/src/pages/cluster/containers/BackupPoint/actions/Create.jsx @@ -30,7 +30,7 @@ class CreateForm extends ModalAction { static title = t('Create'); - static policy = 'clusters:create'; + static policy = 'backuppoints:edit'; get name() { return t('Create'); diff --git a/src/pages/cluster/containers/BackupPoint/actions/Delete.jsx b/src/pages/cluster/containers/BackupPoint/actions/Delete.jsx index 50a3e2ec..0d0dae2a 100644 --- a/src/pages/cluster/containers/BackupPoint/actions/Delete.jsx +++ b/src/pages/cluster/containers/BackupPoint/actions/Delete.jsx @@ -39,7 +39,7 @@ export default class DeleteAction extends ConfirmAction { return t('Delete BackupPoint'); } - policy = 'clusters:delete'; + policy = 'backuppoints:edit'; onSubmit = (item) => { const { name } = item; diff --git a/src/pages/cluster/containers/BackupPoint/actions/Edit.jsx b/src/pages/cluster/containers/BackupPoint/actions/Edit.jsx index 0177e3ae..ab5dc9b6 100644 --- a/src/pages/cluster/containers/BackupPoint/actions/Edit.jsx +++ b/src/pages/cluster/containers/BackupPoint/actions/Edit.jsx @@ -29,7 +29,7 @@ class Edit extends ModalAction { static title = t('Edit BackupPoint'); - static policy = 'clusters:edit'; + static policy = 'backuppoints:edit'; static allowed = () => Promise.resolve(true); diff --git a/src/pages/cluster/containers/Cluster/actions/LinkAddPlugin.jsx b/src/pages/cluster/containers/Cluster/actions/LinkAddPlugin.jsx index 435329ea..ed6ec882 100644 --- a/src/pages/cluster/containers/Cluster/actions/LinkAddPlugin.jsx +++ b/src/pages/cluster/containers/Cluster/actions/LinkAddPlugin.jsx @@ -31,5 +31,5 @@ export default class LinkAddPlugin extends LinkAction { return `/cluster/add-plugin/${item.name}`; } - policy = 'clusters:edit'; + static policy = 'clusters:edit'; } diff --git a/src/pages/cluster/containers/Cluster/actions/LinkAddStorage.jsx b/src/pages/cluster/containers/Cluster/actions/LinkAddStorage.jsx index 221bda83..068dc6c9 100644 --- a/src/pages/cluster/containers/Cluster/actions/LinkAddStorage.jsx +++ b/src/pages/cluster/containers/Cluster/actions/LinkAddStorage.jsx @@ -31,5 +31,5 @@ export default class LinkAddStorage extends LinkAction { return `/cluster/add-storage/${item.name}`; } - policy = 'clusters:edit'; + static policy = 'clusters:edit'; } diff --git a/src/pages/cluster/containers/Cluster/actions/Terminal.jsx b/src/pages/cluster/containers/Cluster/actions/Terminal.jsx index 5efc6ff8..a932347e 100644 --- a/src/pages/cluster/containers/Cluster/actions/Terminal.jsx +++ b/src/pages/cluster/containers/Cluster/actions/Terminal.jsx @@ -35,6 +35,8 @@ export default class ConnectTerminal { static isRunning = (item) => item.status === 'Running'; + static policy = 'clusters:access'; + static allowed = (item) => Promise.resolve(this.isRunning(item)); static openTerminal = async (val) => { diff --git a/src/pages/cluster/containers/LocalRegistry/actions/Add.jsx b/src/pages/cluster/containers/LocalRegistry/actions/Add.jsx index 95672a27..a68b0834 100644 --- a/src/pages/cluster/containers/LocalRegistry/actions/Add.jsx +++ b/src/pages/cluster/containers/LocalRegistry/actions/Add.jsx @@ -29,7 +29,7 @@ class Add extends ModalAction { static title = t('Add'); - static policy = 'platform:edit'; + static policy = 'registries:edit'; get name() { return t('Add'); diff --git a/src/pages/cluster/containers/LocalRegistry/actions/Delete.jsx b/src/pages/cluster/containers/LocalRegistry/actions/Delete.jsx index 1bd3708a..6b62ef63 100644 --- a/src/pages/cluster/containers/LocalRegistry/actions/Delete.jsx +++ b/src/pages/cluster/containers/LocalRegistry/actions/Delete.jsx @@ -40,7 +40,7 @@ export default class DeleteAction extends ConfirmAction { return t('Delete Registry'); } - policy = () => 'platform:edit'; + policy = () => 'registries:edit'; onSubmit = (_, __, props) => { const datas = toJS(store.list.data);