AccessContext class
The current access context (user/session).
Constructors
-
AccessContext({required String userId, Iterable<
String> ? roles, Map<String, dynamic> ? attributes}) - Creates an AccessContext.
- AccessContext.admin(String userId)
-
Creates an admin context with all permissions.
factory
- AccessContext.readOnly(String userId)
-
Creates a read-only context.
factory
Properties
-
attributes
→ Map<
String, dynamic> -
Additional attributes for context-aware authorization.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
roles
→ Set<
String> -
The roles assigned to this context.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- userId → String
-
The user identifier.
final
Methods
-
getAttribute(
String key) → dynamic - Gets an attribute value.
-
hasRole(
String role) → bool -
Whether this context has the given
role. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited