casbin

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Username

func Username(ctx context.Context) (name string)

Username gets the username from the basicauth.

Types

type Casbin

type Casbin struct {
	// contains filtered or unexported fields
}

func Instance

func Instance() *Casbin

func (*Casbin) Check

func (c *Casbin) Check(ctx context.Context) (ok bool)

Check checks the username, request's method and path and returns true if permission grandted otherwise false.

func (*Casbin) CheckReq

func (c *Casbin) CheckReq(r *http.Request) (ok bool)

func (*Casbin) Enabled

func (c *Casbin) Enabled() bool

func (*Casbin) Enforcer

func (c *Casbin) Enforcer() *casbin.Enforcer

func (*Casbin) RegisterTo

func (c *Casbin) RegisterTo(app *iris.Application, optionalEnforcer *casbin.Enforcer)

func (*Casbin) ServeHTTP

func (c *Casbin) ServeHTTP(ctx context.Context)

func (*Casbin) Wrapper

func (c *Casbin) Wrapper() func(w http.ResponseWriter, r *http.Request, router http.HandlerFunc)

Jump to

Keyboard shortcuts

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