Documentation ¶
Index ¶
- func Action(f cli.ActionFunc) cli.ActionFunc
- func IocAction(fn func(*cli.Context, *inject.Graph) error) cli.ActionFunc
- func IsProduction() bool
- func OpenDatabase() (*gorm.DB, error)
- func OpenLogger() *logging.Logger
- func OpenRedis() *redis.Pool
- type Attachment
- type Dao
- func (p *Dao) AddOpenIDUser(pid, pty, email, name, home, logo string) (*User, error)
- func (p *Dao) Allow(role uint, user uint, years, months, days int) error
- func (p *Dao) Authority(user uint, rty string, rid uint) []string
- func (p *Dao) Can(user uint, name string, rty string, rid uint) bool
- func (p *Dao) Deny(role uint, user uint) error
- func (p *Dao) Get(k string, v interface{}) error
- func (p *Dao) GetUserByEmail(email string) (*User, error)
- func (p *Dao) GetUserByUID(uid string) (*User, error)
- func (p *Dao) Is(user uint, name string) bool
- func (p *Dao) Log(user uint, msg string)
- func (p *Dao) Role(name string, rty string, rid uint) (*Role, error)
- func (p *Dao) Set(k string, v interface{}, f bool) error
- func (p *Dao) SignIn(email, password string) (*User, error)
- func (p *Dao) SignUp(email, name, password string) (*User, error)
- func (p *Dao) UserClaims(u *User) jws.Claims
- type Engine
- type Jwt
- type LeaveWord
- type Log
- type Notice
- type Permission
- type Role
- type Setting
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Attachment ¶
type Attachment struct { web.Model Title string Name string MediaType string Summary string UserID uint User User }
Attachment attachment
type Dao ¶
type Dao struct { Db *gorm.DB `inject:""` Encryptor *web.Encryptor `inject:""` Logger *logging.Logger `inject:""` }
Dao db helper
func (*Dao) AddOpenIDUser ¶
AddOpenIDUser add openid user
func (*Dao) GetUserByEmail ¶
GetUserByEmail get user by email
func (*Dao) GetUserByUID ¶
GetUserByUID get user by uid
type Engine ¶
type Engine struct { Cache cache.Store `inject:""` Db *gorm.DB `inject:""` Jobber jobber.Jobber `inject:""` Logger *logging.Logger `inject:""` Encryptor *web.Encryptor `inject:""` I18n *i18n.I18n `inject:""` }
Engine engine model
type Jwt ¶
type Jwt struct { Key []byte `inject:"jwt.key"` Method crypto.SigningMethod `inject:"jwt.method"` Logger *logging.Logger `inject:""` Dao *Dao `inject:""` }
Jwt jwt helper
func (*Jwt) CurrentUserHandler ¶
func (p *Jwt) CurrentUserHandler(must bool) gin.HandlerFunc
CurrentUserHandler inject current user
func (*Jwt) MustAdminHandler ¶
func (p *Jwt) MustAdminHandler() gin.HandlerFunc
MustAdminHandler check must have admin role
func (*Jwt) MustRolesHandler ¶
func (p *Jwt) MustRolesHandler(roles ...string) gin.HandlerFunc
MustRolesHandler check must have one roles at least
type LeaveWord ¶
type LeaveWord struct { ID uint `json:"id"` Content string `json:"content"` CreatedAt time.Time `json:"created_at"` }
LeaveWord leave word
type Log ¶
type Log struct { ID uint `json:"id"` UserID uint `json:"-"` User User `json:"-"` Message string `json:"message"` CreatedAt time.Time `json:"created_at"` }
Log model
type Permission ¶
type Permission struct { web.Model User User UserID uint Role Role RoleID uint Begin time.Time End time.Time }
Permission permission model
type User ¶
type User struct { web.Model Email string `json:"email"` UID string `json:"uid"` Home string `json:"home"` Logo string `json:"logo"` Name string `json:"name"` Password []byte `json:"-"` ProviderType string `json:"provider_type"` ProviderID string `json:"provider_id"` LastSignIn *time.Time `json:"last_sign_in"` SignInCount uint `json:"sign_in_count"` ConfirmedAt *time.Time `json:"confirmed_at"` LockedAt *time.Time `json:"locked_at"` Permissions []Permission `json:"permissions"` Logs []Log `json:"logs"` }
User user model
func (*User) SetGravatarLogo ¶
func (p *User) SetGravatarLogo()
SetGravatarLogo set logo by gravatar
Click to show internal directories.
Click to hide internal directories.