ctx

package
v0.0.0-...-ddfd2c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(conf *config.ViperConfig) echo.MiddlewareFunc

Types

type AclAllows

type AclAllows map[int]db.ACLAllow

type Context

type Context struct {
	echo.Context
	// contains filtered or unexported fields
}

func (*Context) Acl

func (c *Context) Acl() *db.ACL

获取用户访问控制

func (*Context) AclAllows

func (c *Context) AclAllows() AclAllows

获取用户访问控制权限

func (*Context) AclFeatures

func (c *Context) AclFeatures() []string

获取用户访问控制特征

func (*Context) AllowAdmin

func (c *Context) AllowAdmin(code int) bool

检查用户是否有管理权限

func (*Context) AllowRead

func (c *Context) AllowRead(code int) bool

检查用户是否有访问权限

func (*Context) AllowWrite

func (c *Context) AllowWrite(code int) bool

检查用户是否有修改权限

func (*Context) BadRequest

func (c *Context) BadRequest(err error) error

当请求参数不完整时,使用这个函数记录错误原因,然后返回 BadRequest 错误

func (*Context) Config

func (c *Context) Config() *config.ViperConfig

获取配置

func (*Context) Download

func (c *Context) Download(b []byte, filename string) error

文件下载

func (*Context) ErrLog

func (c *Context) ErrLog(err error) *logrus.Entry

func (*Context) Log

func (c *Context) Log() *logrus.Entry

func (*Context) Node

func (c *Context) Node() *db.Tree

获取用户绑定的节点

func (*Context) NodeEntities

func (c *Context) NodeEntities(tp int) ([]db.TreeBind, error)

通过类型查询节点(包含子节点)绑定的实体

func (*Context) SetAcl

func (c *Context) SetAcl(a *db.ACL)

设置用户访问控制

func (*Context) SetAclAllows

func (c *Context) SetAclAllows(a []db.ACLAllow)

设置用户访问控制权限

func (*Context) SetAclFeatures

func (c *Context) SetAclFeatures(a []string)

设置用户访问控制特征

func (*Context) SetLog

func (c *Context) SetLog(l *logrus.Entry)

func (*Context) SetNode

func (c *Context) SetNode(n *db.Tree)

设置用户绑定的节点

func (*Context) SetUser

func (c *Context) SetUser(u *db.User)

设置登录用户

func (*Context) Trim

func (c *Context) Trim(args ...*string)

去除字符串前后空白字符,用法:

c.Trim(&str1, &str2, ...)

func (*Context) User

func (c *Context) User() *db.User

获取登录用户

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL