casbin library

An authorization library that supports access control models like ACL, RBAC, ABAC in Dart.

Classes

AbacClass
This class is required to be implemented by the model to be used for ABAC.
Adapter
Interface for Casbin adapters.
Assertion
Assertion represents an expression in a section of the model. For example: r = sub, obj, act
BatchAdapter
BatchAdapter is the interface for Casbin adapters with multiple add and remove policy functions.
CasbinEvaluator
Config
ConfigInterface
Defines the behavior of a Config implementation.
CoreEnforcer
Defines the core functionality of an enforcer.
DefaultEffector
Default effector for Casbin.
DefaultFilteredAdapter
DefaultFilteredAdapter is the _filtered file adapter for Casbin. It can load policy from file or save policy to file and supports loading of _filtered policies.
DefaultLogger
DefaultRoleManager
Dispatcher
Dispatcher is the interface for dart-casbin dispatcher
DomainRoles
Effector
Interface for Casbin effectors.
Enforcer
FileAdapter
Filter
the filter class. Enforcer only accept this filter currently.
FilteredAdapter
FunctionMap
Helper
InternalEnforcer
InternalEnforcer = CoreEnforcer + Internal API.
Logger
Logger is the logging interface implementation.
ManagementEnforcer
ManagementEnforcer = InternalEnforcer + Management API.
Model
Model represents the whole access control model.
Policy
Role
Represents the data structure for a role in RBAC.
RoleManager
UpdatabelAdapter
Watcher
Watcher is the interface for Casbin watchers.

Constants

DEFAULT_DOMAIN → const String

Properties

evalReg RegExp
final
logger Logger
getter/setter pair

Functions

allMatch(String key1, String key2) bool
allMatch determines whether key1 matches the pattern of key2 , key2 can contain a *.
array2DEquals(List<List<String>> a, List<List<String>> b) bool
array2DEquals determines whether two 2-dimensional string arrays are identical.
arrayRemoveDuplicates(List<String> s) List<String>
arrayRemoveDuplicates removes any duplicated elements in a string array.
arrayToString(List<String> s) String
escapeAssertion(String s) String
escapeAssertion escapes the dots in the assertion, because the expression evaluation doesn't support such variable names.
generateGFunction(RoleManager? rm) → dynamic
generateGFunction is the factory method of the g(_, _) function. rm the role manager used by the function. return the function.
getElementIndex(Assertion? policy, String elementName) int
getElementIndex returns the index of a specific element. policy the policy. For example: policy.value = "sub, obj, act" elementName the element's name. For example: elementName = "act" return the index of a specific element. If the above two example parameters are passed in, it will return 2. -1 if the element does not exist.
getEvalValue(String s) List<String>
getLogger() Logger
globMatch(String key1, String key2) bool
globMatch determines whether key1 matches the pattern of key2 in glob expression.
hasEvalFn(String s) bool
keyGet2Func(String key1, String key2, String pathVar) String
KeyGet2 returns value matched pattern.For example, "/resource1" matches "/:resource", if the pathVar == "resource", then "resource1" will be returned. key1 the first argument. key2 the second argument. return the matched part.
keyGetFunc(String key1, String key2) String
KeyGet returns the matched part. For example, "/foo/bar/foo" matches "/foo/*", "bar/foo" will been returned
keyMatch(String key1, String key2) bool
keyMatch determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a . For example, '/foo/bar' matches '/foo/'
keyMatch2(String key1, String key2) bool
keyMatch2 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a . For example, "/foo/bar" matches "/foo/", "/resource1" matches "/:resource"
keyMatch3(String key1, String key2) bool
keyMatch3 determines whether key1 matches the pattern of key2 (similar to RESTful path) key2 can contain a * For example, "/foo/bar" matches "/foo/*", "/resource1" matches "/{resource}"
keyMatch4(String key1, String key2) bool
KeyMatch4 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *. Besides what KeyMatch3 does, KeyMatch4 can also match repeated patterns:
loadOrDefault<K, V>(Map<K, V> map, K key, V value) → V
regexMatch(String key1, String key2) bool
replaceEval(String s, String rule) String
setLogger(Logger l) → void
splitCommaDelimited(String? s) List<String>?
splitCommaDelimited splits a comma-delimited string into a string array. It assumes that any number of whitespace might exist before or after the comma and that tokens do not include whitespace as part of their value.

Typedefs

MatchingFunc = bool Function(String arg1, String arg2)