Documentation
¶
Overview ¶
Package admin 管理端的相关操作
Index ¶
- type Config
- type Module
- func (m *Module) AddSecurityLog(tx *orm.Tx, uid int64, content, ip, ua string) error
- func (m *Module) AddSecurityLogWithContext(tx *orm.Tx, uid int64, ctx *web.Context, content web.LocaleStringer) error
- func (m *Module) CurrentUser(ctx *web.Context) *user.User
- func (m *Module) GetResourceGroup(mod *cmfx.Module) *rbac.ResourceGroup
- func (m *Module) Middleware(next web.HandlerFunc, method, path, router string) web.HandlerFunc
- func (m *Module) NewResourceGroup(mod *cmfx.Module) *rbac.ResourceGroup
- func (m *Module) ResourceGroup() *rbac.ResourceGroup
- func (m *Module) SSE() *sse.Server[int64]
- func (m *Module) URLPrefix() string
- func (m *Module) UserModule() *user.Users
- type SSE
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// SuperUser 超级用户的 ID
SuperUser int64 `json:"superUser" xml:"superUser,attr" yaml:"superUser" toml:"superUser"`
// User 用户相关的配置
User *user.Config `json:"user" xml:"user" yaml:"user" toml:"user"`
// 上传接口的相关配置
Upload *upload.Config `json:"upload" xml:"upload" yaml:"upload" toml:"upload"`
SSE *SSE `json:"sse,omitempty" xml:"sse,omitempty" yaml:"sse,omitempty" toml:"sse,omitempty"`
}
func (*Config) SanitizeConfig ¶
func (c *Config) SanitizeConfig() *web.FieldError
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func (*Module) AddSecurityLog ¶
AddSecurityLog 记录一条安全日志
func (*Module) AddSecurityLogWithContext ¶
func (m *Module) AddSecurityLogWithContext(tx *orm.Tx, uid int64, ctx *web.Context, content web.LocaleStringer) error
AddSecurityLogWithContext 从 web.Context 中记录一条安全日志
func (*Module) CurrentUser ¶
CurrentUser 获取当前登录的用户信息
func (*Module) GetResourceGroup ¶
func (m *Module) GetResourceGroup(mod *cmfx.Module) *rbac.ResourceGroup
GetResourceGroup 获取指定模块的资源分组
func (*Module) Middleware ¶
func (m *Module) Middleware(next web.HandlerFunc, method, path, router string) web.HandlerFunc
Middleware 验证是否登录
func (*Module) NewResourceGroup ¶
func (m *Module) NewResourceGroup(mod *cmfx.Module) *rbac.ResourceGroup
NewResourceGroup 以模块为单位创建资源分组
func (*Module) ResourceGroup ¶
func (m *Module) ResourceGroup() *rbac.ResourceGroup
ResourceGroup 管理模块的资源分组
func (*Module) UserModule ¶
type SSE ¶ added in v0.8.2
type SSE struct {
// 如果不为零表示发送心跳包的时间
KeepAlive config.Duration `json:"keepAlive,omitempty" xml:"keepAlive,attr,omitempty" yaml:"keepAlive,omitempty" toml:"keepAlive,omitempty"`
// 缓存队列的大小,默认为 10,必须大于 1 才有效。
Cap int `json:"cap,omitempty" xml:"cap,attr,omitempty" yaml:"cap,omitempty" toml:"cap,omitempty"`
// 如果大于零,表示发送 retry 的值。
Retry config.Duration `json:"retry,omitempty" xml:"retry,attr,omitempty" yaml:"retry,omitempty" toml:"retry,omitempty"`
}
SSE 的相关配置
func (*SSE) SanitizeConfig ¶ added in v0.8.2
func (c *SSE) SanitizeConfig() *web.FieldError
Source Files
¶
Click to show internal directories.
Click to hide internal directories.