casbin

package
v0.0.0-...-f0a7105 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 7 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAbacModel string
View Source
var DefaultAclModel string
View Source
var DefaultRbacModel string
View Source
var DefaultRbacWithDomainModel string
View Source
var DefaultRestfullModel string
View Source
var DefaultRestfullWithRoleModel string

Functions

This section is empty.

Types

type Adapter

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

func (*Adapter) AddPolicy

func (sa *Adapter) AddPolicy(_ string, _ string, _ []string) error

func (*Adapter) LoadPolicy

func (sa *Adapter) LoadPolicy(model model.Model) error

func (*Adapter) RemoveFilteredPolicy

func (sa *Adapter) RemoveFilteredPolicy(_ string, _ string, _ int, _ ...string) error

func (*Adapter) RemovePolicy

func (sa *Adapter) RemovePolicy(_ string, _ string, _ []string) error

func (*Adapter) SavePolicy

func (sa *Adapter) SavePolicy(_ model.Model) error

func (*Adapter) SetPolicies

func (sa *Adapter) SetPolicies(policies map[string]interface{})

type OptFunc

type OptFunc func(*State)

func WithFileModel

func WithFileModel(path string) OptFunc

func WithModel

func WithModel(model model.Model) OptFunc

func WithPolicyAdapter

func WithPolicyAdapter(policy *Adapter) OptFunc

func WithStringModel

func WithStringModel(str string) OptFunc

type PolicyRule

type PolicyRule struct {
	PType string `json:"p_type,omitempty"`
	V0    string `json:"v0,omitempty"`
	V1    string `json:"v1,omitempty"`
	V2    string `json:"v2,omitempty"`
	V3    string `json:"v3,omitempty"`
	V4    string `json:"v4,omitempty"`
	V5    string `json:"v5,omitempty"`
}

func (PolicyRule) LoadPolicyLine

func (line PolicyRule) LoadPolicyLine(model model.Model) error

type State

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

func New

func New(_ context.Context, opts ...OptFunc) (*State, error)

func (*State) FilterAuthorizedPairs

func (s *State) FilterAuthorizedPairs(_ context.Context, subjects engine.Subjects, pairs engine.Pairs) (engine.Pairs, error)

func (*State) FilterAuthorizedProjects

func (s *State) FilterAuthorizedProjects(_ context.Context, subjects engine.Subjects) (engine.Projects, error)

func (*State) IsAuthorized

func (s *State) IsAuthorized(_ context.Context, subject engine.Subject, action engine.Action, resource engine.Resource, project engine.Project) (bool, error)

func (*State) ProjectsAuthorized

func (s *State) ProjectsAuthorized(_ context.Context, subjects engine.Subjects, action engine.Action, resource engine.Resource, projects engine.Projects) (engine.Projects, error)

func (*State) SetPolicies

func (s *State) SetPolicies(_ context.Context, policyMap engine.PolicyMap, _ engine.RoleMap) error

Jump to

Keyboard shortcuts

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