filters

package
v0.0.0-...-4b69c17 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FilterUser = func(ctx *context.Context) {
	ok, _ := IsLogin(ctx)
	if !ok {
		ctx.Redirect(302, "/login")
	}
}
View Source
var HasPermission = func(ctx *context.Context) {
	ok, user := IsLogin(ctx)
	if !ok {
		ctx.Redirect(302, "/login")
	} else {
		url := ctx.Request.RequestURI
		beego.Debug("url: ", url)
		flag := models.Enforcer.Enforce(strconv.Itoa(user.Id), url)
		if !flag {
			ctx.WriteString("你没有权限访问这个页面")
		}
	}
}

Functions

func IsLogin

func IsLogin(ctx *context.Context) (bool, models.User)

Types

This section is empty.

Jump to

Keyboard shortcuts

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