Documentation ¶
Index ¶
- type AssertionMap
- type Enforcer
- func (enforcer *Enforcer) AddGroupingPolicy(policy []string)
- func (enforcer *Enforcer) AddGroupingPolicyForPolicyType(ptype string, policy []string)
- func (enforcer *Enforcer) AddObjectAttributeFunction(function Function)
- func (enforcer *Enforcer) AddPolicy(policy []string)
- func (enforcer *Enforcer) AddPolicyForPolicyType(ptype string, policy []string)
- func (enforcer *Enforcer) AddSubjectAttributeFunction(function Function)
- func (enforcer *Enforcer) Enable(enable bool)
- func (enforcer *Enforcer) Enforce(rvals ...string) bool
- func (enforcer *Enforcer) GetAllActions() []string
- func (enforcer *Enforcer) GetAllObjects() []string
- func (enforcer *Enforcer) GetAllRoles() []string
- func (enforcer *Enforcer) GetAllSubjects() []string
- func (enforcer *Enforcer) GetFilteredPolicy(fieldIndex int, fieldValue string) [][]string
- func (enforcer *Enforcer) GetFilteredPolicyForPolicyType(ptype string, fieldIndex int, fieldValue string) [][]string
- func (enforcer *Enforcer) GetGroupingPolicy() [][]string
- func (enforcer *Enforcer) GetGroupingPolicyForPolicyType(ptype string) [][]string
- func (enforcer *Enforcer) GetPolicy() [][]string
- func (enforcer *Enforcer) GetPolicyForPolicyType(ptype string) [][]string
- func (enforcer *Enforcer) GetRoles(name string) []string
- func (enforcer *Enforcer) GetRolesForPolicyType(ptype string, name string) []string
- func (enforcer *Enforcer) Init(modelPath string, policyPath string)
- func (enforcer *Enforcer) LoadAll()
- func (enforcer *Enforcer) LoadPolicy()
- func (enforcer *Enforcer) RemoveGroupingPolicy(policy []string)
- func (enforcer *Enforcer) RemoveGroupingPolicyForPolicyType(ptype string, policy []string)
- func (enforcer *Enforcer) RemovePolicy(policy []string)
- func (enforcer *Enforcer) RemovePolicyForPolicyType(ptype string, policy []string)
- func (enforcer *Enforcer) SavePolicy()
- type Function
- type FunctionMap
- type Model
- type Role
- type RoleManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssertionMap ¶
type AssertionMap map[string]*assertion
AssertionMap is the collection of assertions, can be "r", "p", "g", "e", "m".
type Enforcer ¶
type Enforcer struct {
// contains filtered or unexported fields
}
Enforcer is the main interface for authorization enforcement and policy management.
func (*Enforcer) AddGroupingPolicy ¶ added in v0.0.2
Add a role inheritance rule to the current policy.
func (*Enforcer) AddGroupingPolicyForPolicyType ¶ added in v0.0.2
Add a role inheritance rule to the current policy, policy type can be specified.
func (*Enforcer) AddObjectAttributeFunction ¶ added in v0.0.2
Add the function that gets attributes for a object in ABAC.
func (*Enforcer) AddPolicyForPolicyType ¶ added in v0.0.2
Add an authorization rule to the current policy, policy type can be specified.
func (*Enforcer) AddSubjectAttributeFunction ¶ added in v0.0.2
Add the function that gets attributes for a subject in ABAC.
func (*Enforcer) Enable ¶ added in v0.0.2
Change the enforcing state of casbin, when casbin is disabled, all access will be allowed by the Enforce() function.
func (*Enforcer) Enforce ¶ added in v0.0.2
Decide whether a "subject" can access a "object" with the operation "action", input parameters are usually: (sub, obj, act).
func (*Enforcer) GetAllActions ¶ added in v0.0.2
Get the list of actions that show up in the current policy.
func (*Enforcer) GetAllObjects ¶ added in v0.0.2
Get the list of objects that show up in the current policy.
func (*Enforcer) GetAllRoles ¶ added in v0.0.2
Get the list of roles that show up in the current policy.
func (*Enforcer) GetAllSubjects ¶ added in v0.0.2
Get the list of subjects that show up in the current policy.
func (*Enforcer) GetFilteredPolicy ¶ added in v0.0.2
Get all the authorization rules in the policy, a field filter can be specified.
func (*Enforcer) GetFilteredPolicyForPolicyType ¶ added in v0.0.2
func (enforcer *Enforcer) GetFilteredPolicyForPolicyType(ptype string, fieldIndex int, fieldValue string) [][]string
Get all the authorization rules in the policy, a field filter can be specified, policy type can be specified.
func (*Enforcer) GetGroupingPolicy ¶ added in v0.0.2
Get all the role inheritance rules in the policy.
func (*Enforcer) GetGroupingPolicyForPolicyType ¶ added in v0.0.2
Get all the role inheritance rules in the policy, policy type can be specified.
func (*Enforcer) GetPolicyForPolicyType ¶ added in v0.0.2
Get all the authorization rules in the policy, policy type can be specified.
func (*Enforcer) GetRolesForPolicyType ¶ added in v0.0.2
Get the roles assigned to a subject, policy type can be specified.
func (*Enforcer) LoadAll ¶ added in v0.0.2
func (enforcer *Enforcer) LoadAll()
Reload the model file and policy file, usually used when those files have been changed.
func (*Enforcer) LoadPolicy ¶ added in v0.0.2
func (enforcer *Enforcer) LoadPolicy()
Reload the policy file only.
func (*Enforcer) RemoveGroupingPolicy ¶ added in v0.0.2
Remove a role inheritance rule from the current policy.
func (*Enforcer) RemoveGroupingPolicyForPolicyType ¶ added in v0.0.2
Remove a role inheritance rule from the current policy, policy type can be specified.
func (*Enforcer) RemovePolicy ¶ added in v0.0.2
Remove an authorization rule from the current policy.
func (*Enforcer) RemovePolicyForPolicyType ¶ added in v0.0.2
Remove an authorization rule from the current policy, policy type can be specified.
func (*Enforcer) SavePolicy ¶ added in v0.0.2
func (enforcer *Enforcer) SavePolicy()
Save the current policy (usually changed with casbin API) back to the policy file.
type Function ¶ added in v0.0.2
type Function func(args ...interface{}) (interface{}, error)
Function represents a function that is used in the matchers, used to get attributes in ABAC.
type FunctionMap ¶ added in v0.0.2
FunctionMap represents the collection of Function.
type Role ¶
type Role struct {
// contains filtered or unexported fields
}
Role is the data structure for a role in RBAC.
type RoleManager ¶
type RoleManager struct {
// contains filtered or unexported fields
}
RoleManager is the interface to manage the roles in RBAC.