调整系统管理入口并实现用户分组与角色可见范围
This commit is contained in:
1 parent
c91aab659b
commit
5bcada2ac8
28 files changed
+915
-72
No files matched your search
@@ -29,6 +29,9 @@ test("用户管理导航按权限显示,权限变化后回到基本信息", ()
|
||||
navigation.selectSection("users");
|
||||
assert.equal(navigation.activeSection.value, "users");
|
||||
user.value = { role: "admin" };
|
||||
assert.equal(navigation.activeSection.value, "users");
|
||||
assert.equal(navigation.sections.value.length, 6);
|
||||
user.value = null;
|
||||
assert.equal(navigation.activeSection.value, "overview");
|
||||
assert.equal(navigation.sections.value.length, 5);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup>
|
||||
import ChangePassword from "../components/ChangePassword/ChangePassword.vue";
|
||||
import UserManagement from "../UserManagement/UserManagement.vue";
|
||||
import SettingsModal from "./SettingsModal.vue";
|
||||
import DomainModal from "./DomainModal.vue";
|
||||
@@ -145,16 +144,12 @@ const { activeSection, activeLabel, sections, selectSection } = useDashboardNavi
|
||||
<h1>证书管理总览</h1>
|
||||
</div>
|
||||
<div class="topbar-actions">
|
||||
<ChangePassword />
|
||||
<button class="secondary-button" type="button" @click="loadData">
|
||||
刷新状态
|
||||
</button>
|
||||
<button v-if="activeSection === 'activity'" class="secondary-button" type="button" @click="runRenewalNow">
|
||||
立即检查续期
|
||||
</button>
|
||||
<button class="secondary-button" type="button" @click="openSettings">
|
||||
系统设置
|
||||
</button>
|
||||
<button
|
||||
class="secondary-button"
|
||||
type="button"
|
||||
@@ -504,6 +499,7 @@ const { activeSection, activeLabel, sections, selectSection } = useDashboardNavi
|
||||
:active-section="activeSection"
|
||||
:sections="sections"
|
||||
@select="selectSection"
|
||||
@settings="openSettings"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ export const dashboardSections = [
|
||||
export function useDashboardNavigation(currentUser) {
|
||||
const selectedSection = ref("overview");
|
||||
const sections = computed(() => dashboardSections.filter(
|
||||
(section) => section.id !== "users" || currentUser.value?.role === "super_admin",
|
||||
(section) => section.id !== "users" || ["super_admin", "admin"].includes(currentUser.value?.role),
|
||||
));
|
||||
const activeSection = computed(() => sections.value.some(
|
||||
(section) => section.id === selectedSection.value,
|
||||
|
||||
@@ -4,7 +4,7 @@ defineProps({
|
||||
sections: { type: Array, required: true },
|
||||
});
|
||||
|
||||
defineEmits(["select"]);
|
||||
defineEmits(["select", "settings"]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -55,6 +55,18 @@ defineEmits(["select"]);
|
||||
<i v-if="activeSection === section.id" class="navigation-current" aria-hidden="true"></i>
|
||||
</button>
|
||||
</template>
|
||||
<button
|
||||
class="navigation-item"
|
||||
type="button"
|
||||
title="配置服务、证书签发和邮件通知"
|
||||
aria-haspopup="dialog"
|
||||
@click="$emit('settings')"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||
<path d="M4 7h16M4 17h16M8 4v6M16 14v6" />
|
||||
</svg>
|
||||
<span>系统设置</span>
|
||||
</button>
|
||||
<p class="navigation-footer">SSL 证书管理</p>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
Reference in new issue
Block a user