Documentation
¶
Index ¶
- Variables
- type AUStatus
- type Action
- type App
- type AppUser
- type Auth
- type BaseModel
- type File
- type History
- type JSON
- type JSONTime
- type Message
- type Resource
- type Role
- type User
- func (u *User) CheckLogin(ps string) (bool, error)
- func (u *User) GetAuth(uuid, ResourceID string, ResourceUUID ...string) oalib.AuthLevel
- func (u *User) GetAuths() []*Auth
- func (u *User) GetToken(uuid string, key []byte) (string, error)
- func (u *User) LoadAuths(tx *gorm.DB) error
- func (u *User) String() string
- func (u *User) UpdatePass(ps string) (err error)
- type UserRole
- type Wechat
Constants ¶
This section is empty.
Variables ¶
View Source
var AppKeys = map[string]string{}
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
UUID string `gorm:"primaryKey;size:32"`
CreatedAt JSONTime
UpdatedAt JSONTime
DeletedAt gorm.DeletedAt `gorm:"index"`
Name string
Icon string
Des string
Creator uint
UserCount uint
Users []*User `gorm:"many2many:AppUsers;"`
// 初始用户角色
InitRoleID uint
InitRole *Role
// 是否在首页隐藏
Hide bool
// PubKey string
// PrivateKey string
// 认证成功跳转链接
Host string
// 加解密用户token (key+key2)
// 两个key都是请求获取时刷新
// key oa发放给app 双方保存 针对app生成 每个应用有一个
// key2 app发放给oa app保存 oa使用一次销毁 针对当个用户生成 每个用户有一个
// 获取app用户加密秘钥key2
// TODO
UserRefreshUrl string
// app 校验用户token时使用
Key string `json:"-"`
// 是否允许用户自动加入应用
EnableRegister bool
//
EnableUserKey bool
UserKeyUrl string
// 允许登录方式
EnableUser bool
EnableWx bool
EnablePhone bool
EnableEmail bool
Wx *Wechat `gorm:"-"`
}
type Auth ¶
type Auth struct {
BaseModel
// 该权限作用的应用
AppUUID string `gorm:"size:32"`
App *App `gorm:"association_foreignkey:UUID"`
// 权限绑定只能绑定一个
RoleID *uint
Role *Role
UserID *uint
User *User
// 资源id
ResourceID uint `gorm:"not null"`
Resource *Resource
// resource_name 用于其他系统方便区分权限的名字
RID string `gorm:""`
// 具体某个资源的id
RUID string
Level oalib.AuthLevel
}
Auth 资源权限
type File ¶ added in v1.0.0
type File struct {
CreatedAt time.Time
OwnerID string
Path string
Size uint
MD5 string
Count uint
Tag string
// contains filtered or unexported fields
}
File es model
type JSONTime ¶
JSONTime custom json time
func (JSONTime) MarshalJSON ¶
MarshalJSON 实现它的json序列化方法
func (*JSONTime) UnmarshalJSON ¶
UnmarshalJSON 反序列化方法
type User ¶
type User struct {
BaseModel
Username string `gorm:"type:varchar(100);unique;not null"`
Nickname string `gorm:"type:varchar(100)"`
Phone string `gorm:"type:varchar(20);unique;default:null"`
Email string `gorm:"type:varchar(50);unique;default:null"`
CheckCode string `gorm:"type:varchar(64);not null" json:"-"`
RealCode string `gorm:"type:varchar(32);not null" json:"-"`
Position string
// disabled 禁用
Status string
Icon string
Roles []*Role `gorm:"many2many:UserRoles;"`
Apps []*AppUser `gorm:""`
Auths []*Auth `gorm:"foreignkey:UserID;references:ID"`
Used uint `gorm:"default:0"`
Space uint `gorm:"default:300"`
}
User db user model
func (*User) UpdatePass ¶
Click to show internal directories.
Click to hide internal directories.