diff --git a/console/console-src/modules/contents/pages/SinglePageEditor.vue b/console/console-src/modules/contents/pages/SinglePageEditor.vue index 1fd356fc8..ddfec1d7a 100644 --- a/console/console-src/modules/contents/pages/SinglePageEditor.vue +++ b/console/console-src/modules/contents/pages/SinglePageEditor.vue @@ -40,10 +40,12 @@ import { useAutoSaveContent } from "@console/composables/use-auto-save-content"; import { useContentSnapshot } from "@console/composables/use-content-snapshot"; import { useSaveKeybinding } from "@console/composables/use-save-keybinding"; import { useSessionKeepAlive } from "@/composables/use-session-keep-alive"; +import { usePermission } from "@/utils/permission"; const router = useRouter(); const { t } = useI18n(); const { mutateAsync: singlePageUpdateMutate } = usePageUpdateMutate(); +const { currentUserHasPermission } = usePermission(); // Editor providers const { editorProviders } = useEditorExtensionPoints(); @@ -379,6 +381,9 @@ useSessionKeepAlive(); // Upload image async function handleUploadImage(file: File) { + if (!currentUserHasPermission(["uc:attachments:manage"])) { + return; + } if (!isUpdateMode.value) { await handleSave(); } diff --git a/console/console-src/modules/contents/posts/PostEditor.vue b/console/console-src/modules/contents/posts/PostEditor.vue index dbf9e4824..33cdc71cd 100644 --- a/console/console-src/modules/contents/posts/PostEditor.vue +++ b/console/console-src/modules/contents/posts/PostEditor.vue @@ -40,10 +40,12 @@ import { useAutoSaveContent } from "@console/composables/use-auto-save-content"; import { useContentSnapshot } from "@console/composables/use-content-snapshot"; import { useSaveKeybinding } from "@console/composables/use-save-keybinding"; import { useSessionKeepAlive } from "@/composables/use-session-keep-alive"; +import { usePermission } from "@/utils/permission"; const router = useRouter(); const { t } = useI18n(); const { mutateAsync: postUpdateMutate } = usePostUpdateMutate(); +const { currentUserHasPermission } = usePermission(); // Editor providers const { editorProviders } = useEditorExtensionPoints(); @@ -404,6 +406,10 @@ useSessionKeepAlive(); // Upload image async function handleUploadImage(file: File) { + if (!currentUserHasPermission(["uc:attachments:manage"])) { + return; + } + if (!isUpdateMode.value) { await handleSave(); } diff --git a/console/console-src/modules/system/settings/SystemSettings.vue b/console/console-src/modules/system/settings/SystemSettings.vue index 706872de6..04f5c6b0f 100644 --- a/console/console-src/modules/system/settings/SystemSettings.vue +++ b/console/console-src/modules/system/settings/SystemSettings.vue @@ -19,8 +19,10 @@ import { markRaw } from "vue"; import SettingTab from "./tabs/Setting.vue"; import { useRouteQuery } from "@vueuse/router"; import NotificationsTab from "./tabs/Notifications.vue"; +import { usePermission } from "@/utils/permission"; const { t } = useI18n(); +const { currentUserHasPermission } = usePermission(); interface Tab { id: string; @@ -63,11 +65,13 @@ const { data: setting } = useQuery({ } // TODO: use integrations center to refactor this - tabs.value.push({ - id: "notification", - label: "通知设置", - component: markRaw(NotificationsTab), - }); + if (currentUserHasPermission(["system:notifier:configuration"])) { + tabs.value.push({ + id: "notification", + label: "通知设置", + component: markRaw(NotificationsTab), + }); + } } }, }); diff --git a/console/src/locales/en.yaml b/console/src/locales/en.yaml index 2e6427386..e5e236c68 100644 --- a/console/src/locales/en.yaml +++ b/console/src/locales/en.yaml @@ -1337,6 +1337,15 @@ core: role-template-change-password: Change Password Actuator Management: System Information Actuator Manage: Access System Information + Cache Management: Cache + Cache Manage: Cache Manage + Notification Configuration: Notification Configuration + Configure Notifier: Configure Notifier + Post Attachment Manager: Allow images to be uploaded in posts + Post Author: Author + Post Contributor: Contributor + Post Editor: Editor + Post Publisher: Allow to publish own posts components: submit_button: computed_text: "{text} ({shortcut})" diff --git a/console/src/locales/zh-CN.yaml b/console/src/locales/zh-CN.yaml index 300d5d0c1..c5f1debfa 100644 --- a/console/src/locales/zh-CN.yaml +++ b/console/src/locales/zh-CN.yaml @@ -1265,6 +1265,15 @@ core: role-template-change-password: 修改密码 Actuator Management: 系统指标 Actuator Manage: 访问系统指标 + Cache Management: 缓存 + Cache Manage: 缓存管理 + Notification Configuration: 通知配置 + Configure Notifier: 配置通知器 + Post Editor: 编辑者 + Post Contributor: 投稿者 + Post Author: 作者 + Post Attachment Manager: 允许在文章中上传图片 + Post Publisher: 允许发布自己的文章 components: submit_button: computed_text: "{text}({shortcut})" diff --git a/console/src/locales/zh-TW.yaml b/console/src/locales/zh-TW.yaml index 20d08648c..67cea9303 100644 --- a/console/src/locales/zh-TW.yaml +++ b/console/src/locales/zh-TW.yaml @@ -1253,6 +1253,15 @@ core: role-template-change-password: 修改密碼 Actuator Management: 系統指標 Actuator Manage: 訪問系統指標 + Cache Management: 緩存 + Cache Manage: 緩存管理 + Configure Notifier: 配置通知器 + Notification Configuration: 通知配置 + Post Attachment Manager: 允許在文章中上傳圖片 + Post Author: 作者 + Post Contributor: 投稿者 + Post Editor: 編輯者 + Post Publisher: 允許發布自己的文章 components: submit_button: computed_text: "{text}({shortcut})" diff --git a/console/uc-src/modules/contents/posts/PostEditor.vue b/console/uc-src/modules/contents/posts/PostEditor.vue index 074b6c157..81765e96f 100644 --- a/console/uc-src/modules/contents/posts/PostEditor.vue +++ b/console/uc-src/modules/contents/posts/PostEditor.vue @@ -33,9 +33,11 @@ import HasPermission from "@/components/permission/HasPermission.vue"; import { provide } from "vue"; import type { ComputedRef } from "vue"; import { useSessionKeepAlive } from "@/composables/use-session-keep-alive"; +import { usePermission } from "@/utils/permission"; const router = useRouter(); const { t } = useI18n(); +const { currentUserHasPermission } = usePermission(); const formState = ref({ apiVersion: "content.halo.run/v1alpha1", @@ -333,6 +335,9 @@ function onUpdatePostSuccess(data: Post) { // Upload image async function handleUploadImage(file: File) { + if (!currentUserHasPermission(["uc:attachments:manage"])) { + return; + } if (!isUpdateMode.value) { formState.value.metadata.annotations = { ...formState.value.metadata.annotations,