Documentation
¶
Index ¶
- Constants
- func CreateCertificate(ca bool, subject pkix.Name, years int) ([]byte, []byte, error)
- func WritePemFile(file, _type string, buf []byte, mode os.FileMode) error
- type Attachment
- type Card
- type Dao
- func (p *Dao) AddEmailUser(db orm.DB, lang, ip, name, email, password string) (*User, error)
- func (p *Dao) AddLog(db orm.DB, user uint, ip, lang, format string, args ...interface{}) error
- func (p *Dao) Allow(db orm.DB, user uint, role uint, years, months, days int) error
- func (p *Dao) Authority(db orm.DB, user uint, rty string, rid uint) ([]string, error)
- func (p *Dao) Can(db orm.DB, user uint, name string, rty string, rid uint) bool
- func (p *Dao) Deny(db orm.DB, user uint, role uint) error
- func (p *Dao) GetRole(db orm.DB, name string, rty string, rid uint) (*Role, error)
- func (p *Dao) GetUserByEmail(tx orm.DB, email string) (*User, error)
- func (p *Dao) GetUserByUID(tx orm.DB, uid string) (*User, error)
- func (p *Dao) Is(db orm.DB, user uint, names ...string) bool
- func (p *Dao) SignIn(db orm.DB, lang, ip, email, password string) (*User, error)
- type FriendLink
- type HTMLHandlerFunc
- type Layout
- type LeaveWord
- type Link
- type Log
- type ObjectHandlerFunc
- type Plugin
- type Policy
- type RedirectHandlerFunc
- type Role
- type User
- type Vote
Constants ¶
View Source
const ( // RoleAdmin admin role RoleAdmin = "admin" // RoleRoot root role RoleRoot = "root" // UserTypeEmail email user UserTypeEmail = "email" // DefaultResourceType default resource type DefaultResourceType = "nil" // DefaultResourceID default resourc id DefaultResourceID = math.MaxInt64 )
View Source
const (
// SendEmailJob send email
SendEmailJob = "send.email"
)
Variables ¶
This section is empty.
Functions ¶
func CreateCertificate ¶
CreateCertificate create certs
Types ¶
type Attachment ¶
type Attachment struct {
ID uint `json:"id"`
Title string `json:"title"`
URL string `json:"url"`
Length int64 `json:"length"`
MediaType string `json:"mediaType"`
ResourceID uint `json:"resourceId"`
ResourceType string `json:"resourceType"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"crateAt"`
User *User `json:"user"`
UserID uint `json:"userId"`
// contains filtered or unexported fields
}
Attachment attachment
type Card ¶
type Card struct {
ID uint `json:"id"`
Lang string `json:"lang"`
Loc string `json:"loc"`
Title string `json:"title"`
Summary string `json:"summary"`
Type string `json:"type"`
Href string `json:"href"`
Logo string `json:"logo"`
Sort int `json:"sort" sql:",notnull"`
Action string `json:"action"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
// contains filtered or unexported fields
}
Card card
type Dao ¶
Dao dao
func (*Dao) AddEmailUser ¶
AddEmailUser add email user
func (*Dao) GetUserByEmail ¶
GetUserByEmail get user by email
func (*Dao) GetUserByUID ¶
GetUserByUID get user by uid
type FriendLink ¶
type FriendLink struct {
ID uint `json:"id"`
Title string `json:"title"`
Home string `json:"home"`
Logo string `json:"logo"`
Sort int `json:"sort" sql:",notnull"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
// contains filtered or unexported fields
}
FriendLink friend_links
type HTMLHandlerFunc ¶
HTMLHandlerFunc html handler func
type Layout ¶
type Layout struct {
I18n *i18n.I18n `inject:""`
Settings *settings.Settings `inject:""`
Jwt *web.Jwt `inject:""`
DB *pg.DB `inject:""`
Dao *Dao `inject:""`
}
Layout layout
func (*Layout) CurrentUser ¶
CurrentUser parse user from request
type LeaveWord ¶
type LeaveWord struct {
ID uint `json:"id"`
Body string `json:"body"`
Type string `json:"type"`
CreatedAt time.Time `json:"createdAt"`
// contains filtered or unexported fields
}
LeaveWord leave-word
type Link ¶
type Link struct {
ID uint `json:"id"`
Lang string `json:"lang"`
Loc string `json:"loc"`
X int `json:"x" sql:",notnull"`
Y int `json:"y" sql:",notnull"`
Href string `json:"href"`
Label string `json:"label"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
// contains filtered or unexported fields
}
Link link
type Log ¶
type Log struct {
ID uint `json:"id"`
Message string `json:"message"`
IP string `json:"ip"`
User *User `json:"user"`
UserID uint `json:"userId"`
CreatedAt time.Time `json:"createdAt"`
// contains filtered or unexported fields
}
Log log
type ObjectHandlerFunc ¶
ObjectHandlerFunc object handle func
type Plugin ¶
type Plugin struct {
Redis *redis.Pool `inject:""`
I18n *i18n.I18n `inject:""`
Cache cache.Cache `inject:""`
Jwt *web.Jwt `inject:""`
Queue queue.Queue `inject:""`
Settings *settings.Settings `inject:""`
Security *web.Security `inject:""`
Storage storage.Storage `inject:""`
Router *mux.Router `inject:""`
DB *pg.DB `inject:""`
Dao *Dao `inject:""`
Layout *Layout `inject:""`
}
Plugin plugin
type Policy ¶
type Policy struct {
ID uint
Nbf time.Time
Exp time.Time
UpdatedAt time.Time
CreatedAt time.Time
User *User
UserID uint
Role *Role
RoleID uint
// contains filtered or unexported fields
}
Policy policy
type RedirectHandlerFunc ¶
RedirectHandlerFunc redirect handle func
type Role ¶
type Role struct {
ID uint
Name string
ResourceID uint
ResourceType string
UpdatedAt time.Time
CreatedAt time.Time
// contains filtered or unexported fields
}
Role role
type User ¶
type User struct {
ID uint `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
UID string `json:"uid"`
Password []byte `json:"-"`
ProviderID string `json:"providerId"`
ProviderType string `json:"providerType"`
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:"lockAt"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
Logs []Log `json:"logs"`
// contains filtered or unexported fields
}
User user
func (*User) SetGravatarLogo ¶
func (p *User) SetGravatarLogo()
SetGravatarLogo set logo by gravatar
Click to show internal directories.
Click to hide internal directories.