diff --git a/internal/common/helper.go b/internal/common/helper.go index 04ce89c..8f51f24 100644 --- a/internal/common/helper.go +++ b/internal/common/helper.go @@ -22,6 +22,10 @@ func BuildPageData(c *gin.Context, extra gin.H) gin.H { } // 注入站点信息(由 InjectSiteInfo 中间件设置) injectSiteInfo(c, data) + // 注入管理入口权限(moderator 及以上可看到页脚管理面板链接) + if role, exists := c.Get("role"); exists { + data["CanAccessAdmin"] = model.HasMinRole(role.(string), model.RoleModerator) + } return data } diff --git a/templates/MetaLab-2026/html/layout/footer.html b/templates/MetaLab-2026/html/layout/footer.html index 38ae339..3f7c705 100644 --- a/templates/MetaLab-2026/html/layout/footer.html +++ b/templates/MetaLab-2026/html/layout/footer.html @@ -1,5 +1,5 @@ diff --git a/templates/MetaLab-2026/html/layout/header.html b/templates/MetaLab-2026/html/layout/header.html index 5be7973..81fc2d7 100644 --- a/templates/MetaLab-2026/html/layout/header.html +++ b/templates/MetaLab-2026/html/layout/header.html @@ -4,7 +4,7 @@ {{if .CSRFToken}}{{end}} -