package auth // AccountStatus 账号状态 type AccountStatus string const ( StatusActive AccountStatus = "active" StatusPendingApproval AccountStatus = "pending_approval" StatusDisabled AccountStatus = "disabled" ) // UserAccount 用户账号与受控职位实体 type UserAccount struct { ID int64 `json:"id"` Username string `json:"username"` Name string `json:"name"` PasswordHash string `json:"password_hash,omitempty"` Status AccountStatus `json:"status"` MustChangePassword bool `json:"must_change_password"` RoleID string `json:"role_id"` Position string `json:"position"` EmployeeID string `json:"employee_id,omitempty"` Department string `json:"department,omitempty"` Email string `json:"email,omitempty"` Locale string `json:"locale,omitempty"` Timezone string `json:"timezone,omitempty"` Avatar string `json:"avatar,omitempty"` // ProfileUpdatedBy 非零时表示最近一次展示资料由管理员代改(自助保存后清零)。 ProfileUpdatedBy int64 `json:"profile_updated_by,omitempty"` ProfileUpdatedAt string `json:"profile_updated_at,omitempty"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` } // UserDirectoryEntry 已登录用户可见的轻量用户目录项(不含敏感字段)。 type UserDirectoryEntry struct { ID int64 `json:"id"` Username string `json:"username"` Name string `json:"name"` Department string `json:"department,omitempty"` Position string `json:"position,omitempty"` } // ProfilePatch 自助或管理员更新展示资料的可选字段。 type ProfilePatch struct { Name *string `json:"name,omitempty"` Email *string `json:"email,omitempty"` Department *string `json:"department,omitempty"` EmployeeID *string `json:"employee_id,omitempty"` Locale *string `json:"locale,omitempty"` Timezone *string `json:"timezone,omitempty"` } // SystemAuthConfig 系统全局认证与准入配置 type SystemAuthConfig struct { AllowRegistration bool `json:"allow_registration"` RequireApproval bool `json:"require_approval"` } // SessionInfo 登录会话与身份上下文 type SessionInfo struct { Token string `json:"token"` User *UserAccount `json:"user"` MustChangePassword bool `json:"must_change_password"` Env string `json:"env"` }