Versions in this module Expand all Collapse all v0 v0.0.2 Mar 10, 2020 v0.0.1 Mar 8, 2020 Changes in this version + const Anyone + var ErrPermissionDenied = errors.New("permission denied") + var Global = &Role + func HasRole(req *http.Request, user interface{}, roles ...string) bool + func MatchedRoles(req *http.Request, user interface{}) []string + func Register(name string, fc Checker) + func Remove(name string) + func Reset() + type Checker func(req *http.Request, user interface{}) bool + func Get(name string) (Checker, bool) + type Permission struct + AllowedRoles map[PermissionMode][]string + DeniedRoles map[PermissionMode][]string + Role *Role + func Allow(mode PermissionMode, roles ...string) *Permission + func Deny(mode PermissionMode, roles ...string) *Permission + func NewPermission() *Permission + func (permission *Permission) Allow(mode PermissionMode, roles ...string) *Permission + func (permission *Permission) Concat(newPermission *Permission) *Permission + func (permission *Permission) Deny(mode PermissionMode, roles ...string) *Permission + func (permission Permission) HasPermission(mode PermissionMode, roles ...interface{}) bool + type PermissionMode string + const CRUD + const Create + const Delete + const Read + const Update + type Permissioner interface + HasPermission func(mode PermissionMode, roles ...interface{}) bool + func ConcatPermissioner(ps ...Permissioner) Permissioner + type Role struct + func New() *Role + func (role *Role) Allow(mode PermissionMode, roles ...string) *Permission + func (role *Role) Deny(mode PermissionMode, roles ...string) *Permission + func (role *Role) Get(name string) (Checker, bool) + func (role *Role) HasRole(req *http.Request, user interface{}, roles ...string) bool + func (role *Role) MatchedRoles(req *http.Request, user interface{}) (roles []string) + func (role *Role) NewPermission() *Permission + func (role *Role) Register(name string, fc Checker) + func (role *Role) Remove(name string) + func (role *Role) Reset() + type Roler interface + GetRoles func() []string