type Enforcer ¶
type Enforcer struct { // contains filtered or unexported fields }
Enforcer is the main interface for authorization enforcement and policy management.
func NewEnforcer(params ...interface{}) *Enforcer
func NewEnforcerSafe(params ...interface{}) (e *Enforcer, err error)
func (e *Enforcer) AddFunction(name string, function func(args ...interface{}) (interface{}, error))
func (e *Enforcer) AddGroupingPolicy(params ...interface{}) bool
func (e *Enforcer) AddNamedGroupingPolicy(ptype string, params ...interface{}) bool
func (e *Enforcer) AddNamedPolicy(ptype string, params ...interface{}) bool
func (e *Enforcer) AddPermissionForUser(user string, permission ...string) bool
func (e *Enforcer) AddPolicy(params ...interface{}) bool
func (e *Enforcer) AddPolicySafe(params ...interface{}) (result bool, err error)
func (e *Enforcer) AddRoleForUser(user string, role string) bool
func (e *Enforcer) AddRoleForUserInDomain(user string, role string, domain string) bool
func (e *Enforcer) BuildRoleLinks()
func (e *Enforcer) ClearPolicy()
func (e *Enforcer) DeletePermission(permission ...string) bool
func (e *Enforcer) DeletePermissionForUser(user string, permission ...string) bool
func (e *Enforcer) DeletePermissionsForUser(user string) bool
func (e *Enforcer) DeleteRole(role string)
func (e *Enforcer) DeleteRoleForUser(user string, role string) bool
func (e *Enforcer) DeleteRoleForUserInDomain(user string, role string, domain string) bool
func (e *Enforcer) DeleteRolesForUser(user string) bool
func (e *Enforcer) DeleteUser(user string) bool
func (e *Enforcer) EnableAutoBuildRoleLinks(autoBuildRoleLinks bool)
func (e *Enforcer) EnableAutoSave(autoSave bool)
func (e *Enforcer) EnableEnforce(enable bool)
func (e *Enforcer) EnableLog(enable bool)
func (e *Enforcer) Enforce(rvals ...interface{}) bool
func (e *Enforcer) EnforceSafe(rvals ...interface{}) (result bool, err error)
func (e *Enforcer) GetAdapter() persist.Adapter
func (e *Enforcer) GetAllActions() []string
func (e *Enforcer) GetAllNamedActions(ptype string) []string
func (e *Enforcer) GetAllNamedObjects(ptype string) []string
func (e *Enforcer) GetAllNamedRoles(ptype string) []string
func (e *Enforcer) GetAllNamedSubjects(ptype string) []string
func (e *Enforcer) GetAllObjects() []string
func (e *Enforcer) GetAllRoles() []string
func (e *Enforcer) GetAllSubjects() []string
func (e *Enforcer) GetFilteredGroupingPolicy(fieldIndex int, fieldValues ...string) [][]string
func (e *Enforcer) GetFilteredNamedGroupingPolicy(ptype string, fieldIndex int, fieldValues ...string) [][]string
func (e *Enforcer) GetFilteredNamedPolicy(ptype string, fieldIndex int, fieldValues ...string) [][]string
func (e *Enforcer) GetFilteredPolicy(fieldIndex int, fieldValues ...string) [][]string
func (e *Enforcer) GetGroupingPolicy() [][]string
func (e *Enforcer) GetImplicitPermissionsForUser(user string) [][]string
func (e *Enforcer) GetImplicitRolesForUser(name string) []string
func (e *Enforcer) GetModel() model.Model
func (e *Enforcer) GetNamedGroupingPolicy(ptype string) [][]string
func (e *Enforcer) GetNamedPolicy(ptype string) [][]string
func (e *Enforcer) GetPermissionsForUser(user string) [][]string
func (e *Enforcer) GetPermissionsForUserInDomain(user string, domain string) [][]string
func (e *Enforcer) GetPolicy() [][]string
func (e *Enforcer) GetRolesForUser(name string) []string
func (e *Enforcer) GetRolesForUserInDomain(name string, domain string) []string
func (e *Enforcer) GetUsersForRole(name string) []string
func (e *Enforcer) HasGroupingPolicy(params ...interface{}) bool
func (e *Enforcer) HasNamedGroupingPolicy(ptype string, params ...interface{}) bool
func (e *Enforcer) HasNamedPolicy(ptype string, params ...interface{}) bool
func (e *Enforcer) HasPermissionForUser(user string, permission ...string) bool
func (e *Enforcer) HasPolicy(params ...interface{}) bool
func (e *Enforcer) HasRoleForUser(name string, role string) bool
func (e *Enforcer) InitWithAdapter(modelPath string, adapter persist.Adapter)
func (e *Enforcer) InitWithFile(modelPath string, policyPath string)
func (e *Enforcer) InitWithModelAndAdapter(m model.Model, adapter persist.Adapter)
func (e *Enforcer) IsFiltered() bool
func (e *Enforcer) LoadFilteredPolicy(filter interface{}) error
func (e *Enforcer) LoadModel()
func (e *Enforcer) LoadModelSafe() (err error)
func (e *Enforcer) LoadPolicy() error
func (e *Enforcer) RemoveFilteredGroupingPolicy(fieldIndex int, fieldValues ...string) bool
func (e *Enforcer) RemoveFilteredNamedGroupingPolicy(ptype string, fieldIndex int, fieldValues ...string) bool
func (e *Enforcer) RemoveFilteredNamedPolicy(ptype string, fieldIndex int, fieldValues ...string) bool
func (e *Enforcer) RemoveFilteredPolicy(fieldIndex int, fieldValues ...string) bool
func (e *Enforcer) RemoveFilteredPolicySafe(fieldIndex int, fieldValues ...string) (result bool, err error)
func (e *Enforcer) RemoveGroupingPolicy(params ...interface{}) bool
func (e *Enforcer) RemoveNamedGroupingPolicy(ptype string, params ...interface{}) bool
func (e *Enforcer) RemoveNamedPolicy(ptype string, params ...interface{}) bool
func (e *Enforcer) RemovePolicy(params ...interface{}) bool
func (e *Enforcer) RemovePolicySafe(params ...interface{}) (result bool, err error)
func (e *Enforcer) SavePolicy() error
func (e *Enforcer) SetAdapter(adapter persist.Adapter)
func (e *Enforcer) SetEffector(eft effect.Effector)
func (e *Enforcer) SetModel(m model.Model)
func (e *Enforcer) SetRoleManager(rm rbac.RoleManager)
func (e *Enforcer) SetWatcher(watcher persist.Watcher)