Documentation
¶
Overview ¶
Package admin 管理端的相关操作
Index ¶
- Constants
- Variables
- func Install(mod string, db *orm.DB)
- func SexValidator(v any) bool
- func StateValidator(v any) bool
- type Admin
- func (m *Admin) AddSecurityLog(uid int64, content, ip, ua string) error
- func (m *Admin) AddSecurityLogWithContext(uid int64, ctx *web.Context, content string)
- func (m *Admin) AuthFilter(next web.HandlerFunc) web.HandlerFunc
- func (m *Admin) IsAllowChangeGroup(ctx *web.Context, groups types.SliceOf[int64]) (bool, error)
- func (m *Admin) LoginUser(ctx *web.Context) *modelAdmin
- func (m *Admin) RBACFilter(mod string, res string, next web.HandlerFunc) web.HandlerFunc
- func (m *Admin) RegisterResources(mod string, res map[string]web.LocaleStringer) error
- func (m *Admin) URLPrefix() string
- type Sex
- type State
Constants ¶
View Source
const (
// SystemID 表示系统的 ID
SystemID = 0
)
Variables ¶
View Source
var SexRule = web.NewRuleFunc(locales.InvalidValue, SexValidator)
View Source
var StateRule = web.NewRuleFunc(locales.InvalidValue, StateValidator)
Functions ¶
func SexValidator ¶
func StateValidator ¶
Types ¶
type Admin ¶
type Admin struct {
// contains filtered or unexported fields
}
func (*Admin) AddSecurityLog ¶
func (*Admin) AddSecurityLogWithContext ¶
func (*Admin) AuthFilter ¶
func (m *Admin) AuthFilter(next web.HandlerFunc) web.HandlerFunc
AuthFilter 验证是否登录
同时如果在登录状态下,会将当前登录用户的数据写入 ctx.Vars。
func (*Admin) IsAllowChangeGroup ¶
IsAllowChangeGroup 是否允许当前登录用户将角色 groups 赋予其它用户
除超级用户之外,其它任何人只能应用自己当前角色或是子角色给其它用户。
func (*Admin) RBACFilter ¶
func (m *Admin) RBACFilter(mod string, res string, next web.HandlerFunc) web.HandlerFunc
RBACFilter 验证是否拥有指定的权限
NOTE: 需要 Admin.AuthFilter 作为前置条件,用到了其产生的 "admin" 变量。
func (*Admin) RegisterResources ¶
RegisterResources 注册资源
type Sex ¶
type Sex int8
func (Sex) MarshalText ¶
MarshalText encoding.TextMarshaler
func (*Sex) UnmarshalText ¶
UnmarshalText encoding.TextUnmarshaler
type State ¶
type State int8
State 表示管理员的状态
func (State) MarshalText ¶
MarshalText encoding.TextMarshaler
func (*State) UnmarshalText ¶
UnmarshalText encoding.TextUnmarshaler
Source Files
¶
Click to show internal directories.
Click to hide internal directories.