Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Casbin ¶
func Casbin(config *CasbinConfig) (buffalo.MiddlewareFunc, error)
Casbin creates a new casbin enforcer for the provided config and returns a permission checking middleware.
func NewCasbinEnforcer ¶
func NewCasbinEnforcer(config *CasbinConfig) error
NewCasbinEnforcer creates and sets a new casbin enforcer for the provided Config. A gorm adapter is used for storage. `model.conf` from the config box is used for model configuration.
Types ¶
type CasbinConfig ¶
type CasbinConfig struct { // Connection provides a database connection. Connection *pop.Connection // Anonymous defines the default "group" for users that are not logged in. Anonymous string // RedirectionURL is the location to which an denied access should redirect. RedirectionURL string // ConfigBox provides access to the casbin configuration files. ConfigBox packr.Box // Enforcer will be set by NewCasbinEnforcer. Enforcer *casbin.Enforcer }
CasbinConfig provides configuration information for the casbin middleware.
func (*CasbinConfig) InitializeRoles ¶
func (config *CasbinConfig) InitializeRoles()
InitializeRoles reads roles.csv from the config box and applies the permission definitions (casbin policy).
Click to show internal directories.
Click to hide internal directories.