Documentation
¶
Index ¶
- func Env(envName string, defaultValue string) (value string)
- func H3hash(s string) string
- func PackagePath() string
- func PostBind(c *gin.Context, ret interface{}) bool
- func Wait()
- type GroupsList
- type Menu
- type Module
- type ModuleList
- type ModuleSettings
- type NotifyStruct
- type Panel
- type Rights
- type Settings
- type Simple
- type Users
- type UsersStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PackagePath ¶
func PackagePath() string
PackagePath returns file path of Summer package location
Types ¶
type GroupsList ¶
func (*GroupsList) Get ¶
func (g *GroupsList) Get(names ...string) (actions []string)
type Menu ¶
type Menu struct {
Title string
Order int
Parent *Menu
Link string
// contains filtered or unexported fields
}
Menu struct
type Module ¶
type Module struct {
*Panel
Collection *mgo.Collection
Settings *ModuleSettings
}
Module struct
func (*Module) GetSettings ¶
func (m *Module) GetSettings() *ModuleSettings
GetSettings needs for correct settings getting from module struct
func (*Module) Websockets ¶
Websockets is default module's websockets method
type ModuleList ¶
ModuleList struct
func (*ModuleList) Get ¶
func (m *ModuleList) Get(name string) (module Simple, exists bool)
Get one module by name
func (*ModuleList) GetList ¶
func (m *ModuleList) GetList() map[string]Simple
GetList returns modules list
type ModuleSettings ¶
type ModuleSettings struct {
Name string // string identifier of module (must be unique)
Title string // visible module name
Menu *Menu // parent menu (panel.MainMenu, panel.DropMenu etc.)
MenuOrder int
MenuTitle string
PageRouteName string // used to build page path: /{Path}/{module.PageRouteName}
AjaxRouteName string // used to build ajax path: /{Path}/ajax/{module.PageRouteName}/*method
SocketsRouteName string // used to build websocket path: /{Path}/websocket/{module.PageRouteName}/*method
CollectionName string // MongoDB collection name
TemplateName string // template in views folder
Icon string // module icon in title
GroupTo Simple // add module like tab to another module
GroupTitle string // tab title
Rights Rights // access rights required to access this page
DisableAuth bool // the page can be viewed for unauthorised visitors
OriginTemplate bool // do not use Footer and Header wraps in template render
// contains filtered or unexported fields
}
ModuleSettings struct
type NotifyStruct ¶
type NotifyStruct struct {
ID uint64 `json:"id" bson:"_id"`
UserID uint64 `json:"userId" bson:"userId"`
Title string `json:"title" bson:"title" binding:"required,min=3"`
Text string `json:"text" bson:"text"`
Created uint `json:"-" bson:"created"`
Updated uint `json:"-" bson:"updated"`
Deleted bool `json:"-" bson:"deleted"`
Demo bool
}
type Panel ¶
type Panel struct {
Settings
// RootMenu is zerro-level menu
RootMenu *Menu
// MainMenu is main admin-panel menu
MainMenu *Menu
// DropMenu is top user dropdown menu
DropMenu *Menu
// Groups
Groups *GroupsList
// Modules
Modules *ModuleList
// Users
Users *Users
// contains filtered or unexported fields
}
Panel struct
func (*Panel) AddModule ¶
func (panel *Panel) AddModule(settings *ModuleSettings, s Simple) Simple
AddModule provide adding new module to Panel
type Settings ¶
type Settings struct {
Port uint
Title string
AuthSalt string
AuthPrefix string
DefaultPage string
Path string // URL path of panel - "/" by default
Views string // file path of ./templates directory
ViewsDoT string // file path of doT.js templates directory
Files string // file path of ./files directory
DBName string // MongoDB database name
UsersCollection string // collection for panel's users
NotifyCollection string // collection for panel's notifications
AICollection string // collection for AUTO_INCREMENT
Debug bool // show `gin` debugging messages
Vars map[string]interface{} // variables, that can be used in templates {{var "variableName"}}
TFuncMap template.FuncMap // `gin` template functions
FirstStart func() // function called after first user creation
DisableAuth bool // if TRUE - without summer auth
DisableFirstStart bool // if TRUE - without first user creating (FirstStart function don't called)
JS []string // external JS resources
CSS []string // external CSS resources
RouterGroup *gin.RouterGroup
Engine *gin.Engine
}
Settings intended for data transmission into the Create method of package
type Simple ¶
type Simple interface {
Page(c *gin.Context)
Ajax(c *gin.Context)
Websockets(c *gin.Context)
GetSettings() *ModuleSettings
// contains filtered or unexported methods
}
Simple module interface
type Users ¶
func (*Users) Get ¶
func (u *Users) Get(id uint64) (user *UsersStruct, exists bool)
Get returns user struct by id
func (*Users) GetByLogin ¶
func (u *Users) GetByLogin(login string) (user *UsersStruct, exists bool)
GetByLogin returns user struct by login
func (*Users) SetAddingFn ¶ added in v1.6.1
func (u *Users) SetAddingFn(fn func(*UsersStruct))
SetAddingFn set callback function that will be called after successful user adding
type UsersStruct ¶
type UsersStruct struct {
ID uint64 `form:"id" json:"id" bson:"_id"`
Login string `form:"login" json:"login" bson:"login" valid:"required,min(3)"`
Name string `form:"name" json:"name" bson:"name"`
Notice string `form:"notice" json:"notice" bson:"notice"`
// Is Root-user? Similar as Rights.Groups = ["root"]
Root bool `form:"-" json:"-" bson:"root"`
// Information field, if needs auth by email set Login == Email
Email string `form:"email" json:"email" bson:"email" valid:"email"`
// sha512 hash of password (but from form can be received string password value)
Password string `form:"password" json:"-" bson:"password" valid:"required,min(5)"`
// from form can be received string password value)
Password2 string `form:"password2" json:"-" bson:"-"`
// Default user language (Information field)
Lang string `form:"lang" json:"lang" bson:"lang" valid:"max(3)"`
// Times of creating or editing (or loading from mongoDB)
Created int64 `form:"-" json:"created" bson:"created"`
Updated int64 `form:"-" json:"updated" bson:"updated"`
Loaded int64 `form:"-" json:"-" bson:"-"`
// Fields for users auth limitation
Disabled bool `form:"-" json:"disabled" bson:"disabled"`
Deleted bool `form:"-" json:"deleted" bson:"deleted"`
// User access rights (summer.Rights)
Rights Rights `form:"-" json:"rights" bson:"rights"`
// IP control fields (coming soon)
LastIP uint32 `form:"-" json:"lastIP" bson:"lastIP"`
IP uint32 `form:"-" json:"-" bson:"ip"`
StringIP string `form:"-" json:"ip" bson:"-"`
// custom data map
Settings map[string]interface{} `form:"-" json:"settings" bson:"settings"`
// user without authentication
Demo bool `form:"-" json:"demo" bson:"-"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.

