Documentation
¶
Index ¶
- Constants
- 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(lang, email, password, ip string) (*User, error)
- type Jwt
- type Log
- type Plugin
- func (p *Plugin) Atom(lang string) ([]*atom.Entry, error)
- func (p *Plugin) Console() []cli.Command
- func (p *Plugin) Init()
- func (p *Plugin) Mount(rt *gin.Engine)
- func (p *Plugin) Open(*inject.Graph) error
- func (p *Plugin) Sitemap() ([]stm.URL, error)
- func (p *Plugin) Workers() map[string]job.Handler
- type Policy
- type Role
- type User
- type Vote
Constants ¶
View Source
const ( // TOKEN token session 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 )
View Source
const (
// SendEmailJob send email
SendEmailJob = "send-email"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
web.Model
Title string `json:"title"`
URL string `json:"url"`
Length int64 `json:"length"`
MediaType string `json:"mediaType"`
ResourceID uint `json:"resourceId"`
ResourceType string `json:"resourceType"`
UserID uint `json:"userId"`
User User `json:"-"`
}
Attachment attachment
type Dao ¶
type Dao struct {
Db *gorm.DB `inject:""`
Hmac *security.Hmac `inject:""`
I18n *i18n.I18n `inject:""`
}
Dao auth dao
func (*Dao) AddEmailUser ¶
AddEmailUser add email user
func (*Dao) GetByEmail ¶
GetByEmail get user by email
func (*Dao) GetUserByUID ¶
GetUserByUID get user by uid
type Jwt ¶
type Jwt struct {
Key []byte `inject:"jwt.key"`
Method crypto.SigningMethod `inject:"jwt.method"`
Dao *Dao `inject:""`
I18n *i18n.I18n `inject:""`
}
Jwt jwt helper
func (*Jwt) CurrentUserMiddleware ¶
CurrentUserMiddleware current-user middleware
func (*Jwt) MustAdminMiddleware ¶
MustAdminMiddleware must-admin middleware
func (*Jwt) MustSignInMiddleware ¶
MustSignInMiddleware must-sign-in middleware
type Log ¶
type Log struct {
web.Timestamp
Message string `json:"message"`
Type string `json:"type"`
IP string `json:"ip"`
UserID uint `json:"userId"`
User User `json:"-"`
}
Log log
type Plugin ¶
type Plugin struct {
Db *gorm.DB `inject:""`
Jwt *Jwt `inject:""`
Dao *Dao `inject:""`
I18n *i18n.I18n `inject:""`
Settings *settings.Settings `inject:""`
Server *job.Server `inject:""`
Hmac *security.Hmac `inject:""`
Uploader uploader.Store `inject:""`
}
Plugin plugin
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" gorm:"column: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.