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
+1 -1
View File
@@ -23,7 +23,7 @@ func (s *AuthService) ValidateUser(username string, password string) (*models.Us
if result.Error != nil {
return nil, errors.New("用户名或密码不正确")
}
if user.Role != "admin" && user.Role != "technician" {
if !models.HasBackendAccess(user.Role) {
return nil, errors.New("用户名或密码不正确")
}
if user.Password == "" {