fix: member-created services shouldn't be applied to admin resources (#1113)

This commit is contained in:
UUBulb
2025-08-28 22:37:44 +08:00
committed by GitHub
parent 61b8411d06
commit b6fed87d61
8 changed files with 27 additions and 21 deletions
+9 -3
View File
@@ -8,8 +8,14 @@ import (
"gorm.io/gorm"
)
type Role uint8
func (r Role) IsAdmin() bool {
return r == RoleAdmin
}
const (
RoleAdmin uint8 = iota
RoleAdmin Role = iota
RoleMember
)
@@ -19,13 +25,13 @@ type User struct {
Common
Username string `json:"username,omitempty" gorm:"uniqueIndex"`
Password string `json:"password,omitempty" gorm:"type:char(72)"`
Role uint8 `json:"role,omitempty"`
Role Role `json:"role,omitempty"`
AgentSecret string `json:"agent_secret,omitempty" gorm:"type:char(32)"`
RejectPassword bool `json:"reject_password,omitempty"`
}
type UserInfo struct {
Role uint8
Role Role
AgentSecret string
}