feat: restrict permission roles

This commit is contained in:
Frudrax Cheng
2026-06-06 13:50:56 +08:00
parent a55f515930
commit 5edb25ac4e
17 changed files with 229 additions and 175 deletions
+2 -2
View File
@@ -43,8 +43,8 @@ func (c *AuthController) Login(ctx *gin.Context) {
ErrorResponse(ctx, http.StatusUnauthorized, err.Error())
return
}
if user.Role == "employee" {
ErrorResponse(ctx, http.StatusForbidden, "员工账号无后台登录权限")
if !models.HasBackendAccess(user.Role) {
ErrorResponse(ctx, http.StatusForbidden, "账号无后台登录权限")
return
}