mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-05-06 13:48:52 +00:00
fix: member-created services shouldn't be applied to admin resources (#1113)
This commit is contained in:
+9
-3
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user