Documentation
¶
Index ¶
- Constants
- func CreateCertificate(ca bool, subject pkix.Name, years int) ([]byte, []byte, error)
- func Languages() []string
- func WritePemFile(file, _type string, buf []byte, mode os.FileMode) error
- type AdminPlugin
- type Attachment
- type AttachmentsPlugin
- type Card
- type Dao
- func (p *Dao) AddEmailUser(tx *pg.Tx, name, email, password string) (*User, error)
- func (p *Dao) AddLog(tx *pg.Tx, user uint, ip, lang, format string, args ...interface{}) error
- func (p *Dao) Allow(tx *pg.Tx, user uint, name, rty string, rid uint, years, months, days int) error
- func (p *Dao) Can(user uint, name, rty string, rid uint) bool
- func (p *Dao) Deny(tx *pg.Tx, user uint, name, rty string, rid uint) error
- func (p *Dao) Is(user uint, role string) bool
- func (p *Dao) SignIn(lang, ip, email, password string) (*User, error)
- type FriendLink
- type HomePlugin
- type Layout
- func (p *Layout) Abort(c *gin.Context, s int, e error)
- func (p *Layout) Application(tpl string, fn func(string, gin.H, *gin.Context) error) gin.HandlerFunc
- func (p *Layout) CurrentUserMiddleware(c *gin.Context)
- func (p *Layout) Home(req *http.Request) string
- func (p *Layout) JSON(fn func(string, *gin.Context) (interface{}, error)) gin.HandlerFunc
- func (p *Layout) MustAdminMiddleware(c *gin.Context)
- func (p *Layout) MustSignInMiddleware(c *gin.Context)
- func (p *Layout) Redirect(to string, fn func(string, *gin.Context) error) gin.HandlerFunc
- func (p *Layout) UEditor(act string, check func(*User, uint) bool, ...)
- func (p *Layout) XML(fn func(string, *gin.Context) (interface{}, error)) gin.HandlerFunc
- type LeaveWord
- type Link
- type Log
- type Policy
- type Role
- type User
- type UsersPlugin
- type Vote
Constants ¶
View Source
const ( // NOTICE notice NOTICE = "notice" // WARNING warning WARNING = "warning" // ERROR error ERROR = "error" // TITLE title TITLE = "title" // CurrentUser current user CurrentUser = "currentUser" // IsAdmin is admin? 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 ¶
func CreateCertificate ¶
CreateCertificate create certs
Types ¶
type AdminPlugin ¶
type AdminPlugin struct {
I18n *web.I18n `inject:""`
Cache *web.Cache `inject:""`
Jobber *web.Jobber `inject:""`
Router *gin.Engine `inject:""`
Settings *web.Settings `inject:""`
DB *pg.DB `inject:""`
Redis *redis.Pool `inject:""`
Dao *Dao `inject:""`
Layout *Layout `inject:""`
}
AdminPlugin admin plugin
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" sql:",notnull"`
ResourceType string `json:"resourceType" sql:",notnull"`
User User `json:"user"`
UserID uint `json:"userId"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"crateAt"`
// contains filtered or unexported fields
}
Attachment attachment
type AttachmentsPlugin ¶
type AttachmentsPlugin struct {
UEditor *web.UEditor `inject:""`
I18n *web.I18n `inject:""`
Cache *web.Cache `inject:""`
Router *gin.Engine `inject:""`
DB *pg.DB `inject:""`
Layout *Layout `inject:""`
S3 *web.S3 `inject:""`
Jwt *web.Jwt `inject:""`
}
AttachmentsPlugin attachments plugin
func (*AttachmentsPlugin) Init ¶
func (p *AttachmentsPlugin) Init(*inject.Graph) error
Init init beans
func (*AttachmentsPlugin) Shell ¶
func (p *AttachmentsPlugin) Shell() []cli.Command
Shell console commands
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"`
SortOrder int `json:"sortOrder" 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 ¶
type Dao struct {
DB *pg.DB `inject:""`
I18n *web.I18n `inject:""`
Security *web.Security `inject:""`
}
Dao dao
func (*Dao) AddEmailUser ¶
AddEmailUser add email user
func (*Dao) Allow ¶
func (p *Dao) Allow(tx *pg.Tx, user uint, name, rty string, rid uint, years, months, days int) error
Allow allow
type FriendLink ¶
type FriendLink struct {
ID uint `json:"id"`
Title string `json:"title"`
Home string `json:"home"`
Logo string `json:"logo"`
SortOrder int `json:"sortOrder"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
// contains filtered or unexported fields
}
FriendLink friend_links
type HomePlugin ¶
type HomePlugin struct {
I18n *web.I18n `inject:""`
Cache *web.Cache `inject:""`
Jwt *web.Jwt `inject:""`
Router *gin.Engine `inject:""`
Jobber *web.Jobber `inject:""`
Settings *web.Settings `inject:""`
DB *pg.DB `inject:""`
Dao *Dao `inject:""`
Layout *Layout `inject:""`
}
HomePlugin admin plugin
type Layout ¶
type Layout struct {
Settings *web.Settings `inject:""`
I18n *web.I18n `inject:""`
Jwt *web.Jwt `inject:""`
DB *pg.DB `inject:""`
Dao *Dao `inject:""`
Router *gin.Engine `inject:""`
}
Layout layout
func (*Layout) Application ¶
func (p *Layout) Application(tpl string, fn func(string, gin.H, *gin.Context) error) gin.HandlerFunc
Application application layout
func (*Layout) CurrentUserMiddleware ¶
CurrentUserMiddleware currend user middleware
func (*Layout) MustAdminMiddleware ¶
MustAdminMiddleware currend user middleware
func (*Layout) MustSignInMiddleware ¶
MustSignInMiddleware currend user middleware
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"`
Href string `json:"href"`
Label string `json:"label"`
SortOrder int `json:"sortOrder"`
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 Policy ¶
type Policy struct {
ID uint
Begin time.Time `sql:"_begin"`
End time.Time `sql:"_end"`
User *User
UserID uint
Role *Role
RoleID uint
UpdatedAt time.Time
CreatedAt time.Time
// contains filtered or unexported fields
}
Policy policy
type Role ¶
type Role struct {
ID uint
Name string
ResourceID uint `sql:",notnull"`
ResourceType string `sql:",notnull"`
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"`
Logs []Log `json:"logs"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
// contains filtered or unexported fields
}
User user
func (*User) SetGravatarLogo ¶
func (p *User) SetGravatarLogo()
SetGravatarLogo set logo by gravatar
type UsersPlugin ¶
type UsersPlugin struct {
I18n *web.I18n `inject:""`
Cache *web.Cache `inject:""`
Router *gin.Engine `inject:""`
Jobber *web.Jobber `inject:""`
Settings *web.Settings `inject:""`
Security *web.Security `inject:""`
Jwt *web.Jwt `inject:""`
DB *pg.DB `inject:""`
Dao *Dao `inject:""`
Layout *Layout `inject:""`
}
UsersPlugin admin plugin
Source Files
¶
- dao.go
- env.go
- layouts.go
- models.go
- p-admin-cards.go
- p-admin-friend-links.go
- p-admin-leave-words.go
- p-admin-links.go
- p-admin-locales.go
- p-admin-site.go
- p-admin-users.go
- p-admin.go
- p-attachments-controllers.go
- p-attachments-ueditor.go
- p-attachments.go
- p-home-controllers.go
- p-home-init.go
- p-home-shell.go
- p-home.go
- p-users-controllers.go
- p-users-mount.go
- p-users.go
- ssl.go
Click to show internal directories.
Click to hide internal directories.