feat(auth): 完成租户用户角色资源核心模块

This commit is contained in:
OpenClaw
2026-03-01 10:58:53 +08:00
parent fc7138786b
commit 1de4524b5e
12 changed files with 1619 additions and 51 deletions

View File

@@ -19,7 +19,9 @@ type User struct {
Bio string `gorm:"type:text" json:"bio"`
// 角色和权限
Role string `gorm:"size:20;default:'user'" json:"role"` // super_admin, admin, agent, user
Role string `gorm:"size:20;default:'user'" json:"role"` // super_admin, admin, agent, user (legacy)
RoleID *uint `json:"role_id,omitempty"` // 关联的角色 ID (新的 RBAC)
Roles []Role `gorm:"many2many:user_roles;" json:"roles,omitempty"` // 用户关联的角色(多对多)
Status string `gorm:"size:20;default:'active'" json:"status"` // active, inactive, banned
IsVerified bool `gorm:"default:false" json:"is_verified"`