Documentation ¶
Index ¶
- Constants
- func Action(fn func(*cli.Context, *inject.Graph) error) cli.ActionFunc
- type Attachment
- type Dao
- func (p *Dao) AddEmailUser(name, email, password string) (*User, error)
- func (p *Dao) Allow(role, 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) GetByEmail(email string) (*User, error)
- func (p *Dao) GetUserByUID(uid string) (*User, error)
- func (p *Dao) Is(user uint, names ...string) bool
- func (p *Dao) Log(user uint, ip, message string)
- func (p *Dao) Role(name string, rty string, rid uint) (*Role, error)
- func (p *Dao) SignIn(email, password, lang, ip string) (*User, error)
- type Engine
- type Jwt
- type Log
- type Policy
- type Role
- type User
- type Vote
Constants ¶
View Source
const ( // TOKEN token key TOKEN = "token" // UID uid key UID = "uid" // CurrentUser current-user key CurrentUser = "currentUser" // IsAdmin is-admin key IsAdmin = "isAdmin" )
View Source
const ( // RoleAdmin admin role RoleAdmin = "admin" // RoleRoot root role RoleRoot = "root" // UserTypeEmail email user UserTypeEmail = "email" // DefaultResourceType default resource type DefaultResourceType = "-" // DefaultResourceID default resourc id DefaultResourceID = 0 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Attachment ¶
type Attachment struct { web.Model Title string `json:"title"` URL string `json:"url"` Length int64 `json:"length"` MediaType string `json:"mediaType"` ResourceType string `json:"resourceType"` ResourceID uint `json:"resourceId"` UserID uint `json:"userId"` User User `json:"-"` }
Attachment attachment
func (*Attachment) IsPicture ¶ added in v0.4.1
func (p *Attachment) IsPicture() bool
IsPicture is picture?
type Dao ¶ added in v0.2.0
type Dao struct { Db *gorm.DB `inject:""` Security *web.Security `inject:""` I18n *web.I18n `inject:""` }
Dao auth dao
func (*Dao) AddEmailUser ¶ added in v0.2.0
AddEmailUser add email user
func (*Dao) GetByEmail ¶ added in v0.2.0
GetByEmail get user by email
func (*Dao) GetUserByUID ¶ added in v0.2.0
GetUserByUID get user by uid
type Engine ¶ added in v0.2.0
type Engine struct { Dao *Dao `inject:""` Db *gorm.DB `inject:""` Security *web.Security `inject:""` I18n *web.I18n `inject:""` Jwt *Jwt `inject:""` Uploader web.Uploader `inject:""` Settings *web.Settings `inject:""` Queue *web.Queue `inject:""` }
Engine engine
func (*Engine) RegisterWorker ¶ added in v0.3.0
func (p *Engine) RegisterWorker()
RegisterWorker register worker
type Jwt ¶ added in v0.2.0
type Jwt struct { Key []byte `inject:"jwt.key"` Method crypto.SigningMethod `inject:"jwt.method"` Dao *Dao `inject:""` I18n *web.I18n `inject:""` }
Jwt jwt helper
func (*Jwt) CurrentUserMiddleware ¶ added in v0.3.0
CurrentUserMiddleware current-user middleware
func (*Jwt) MustAdminMiddleware ¶ added in v0.3.0
MustAdminMiddleware must-admin middleware
func (*Jwt) MustSignInMiddleware ¶ added in v0.3.0
MustSignInMiddleware must-sign-in middleware
type Log ¶
type Log struct { ID uint `json:"id"` Message string `json:"message"` Type string `json:"type"` CreatedAt time.Time `json:"createdAt"` IP string `json:"ip"` UserID uint `json:"userId"` User User `json:"-"` }
Log log
type Policy ¶
type Policy struct { web.Model StartUp time.Time ShutDown time.Time UserID uint User User RoleID uint Role Role }
Policy policy
type User ¶
type User struct { web.Model Name string `json:"name"` Email string `json:"email"` UID string `json:"uid"` Password []byte `json:"-"` ProviderID string `json:"-"` ProviderType string `json:"providerType"` Home string `json:"home"` Logo string `json:"logo"` SignInCount uint `json:"signInCount"` LastSignInAt *time.Time `json:"lastSignInAt"` LastSignInIP string `json:"lastSignInIp"` CurrentSignInAt *time.Time `json:"currentSignInAt"` CurrentSignInIP string `json:"currentSignInIp"` ConfirmedAt *time.Time `json:"confirmedAt"` LockedAt *time.Time `json:"lockedAt"` Logs []Log `json:"-"` }
User user
func (*User) SetGravatarLogo ¶
func (p *User) SetGravatarLogo()
SetGravatarLogo set logo by gravatar
Click to show internal directories.
Click to hide internal directories.