mirror of https://github.com/halo-dev/halo
feat: improve the missing UI permissions control (#4960)
#### What type of PR is this? /area console /kind improvement /milestone 2.11.x #### What this PR does / why we need it: 完善遗漏的编辑器上传图片的 UI 权限控制,以及部分 i18n。 #### Does this PR introduce a user-facing change? ```release-note None ```pull/4958/head
parent
90e45b0091
commit
61fe95ab3c
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -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})"
|
||||
|
|
|
@ -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})"
|
||||
|
|
|
@ -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})"
|
||||
|
|
|
@ -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<Post>({
|
||||
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,
|
||||
|
|
Loading…
Reference in New Issue