RbacAbility class

Role-based ability definition.

Constructors

RbacAbility({required List<String> roles, bool any = false, bool allowGuest = false})
const
RbacAbility.all(List<String> roles, {bool allowGuest = false})
Creates a role ability that requires all roles in roles.
factory
RbacAbility.any(List<String> roles, {bool allowGuest = false})
Creates a role ability that allows any role in roles.
factory
RbacAbility.role(String role, {bool allowGuest = false})
Creates a role ability that requires a single role.
factory

Properties

allowGuest → bool
Whether to allow guests when no principal is present.
final
any → bool
Whether any role is sufficient (true) or all roles are required.
final
hashCode → int
The hash code for this object.
no setterinherited
roles → List<String>
Roles required to satisfy the ability.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

evaluate(AuthPrincipal? principal) → bool
Evaluates the ability against the current principal.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited