DVAuthAuthorization class

Constructors

DVAuthAuthorization()
const

Properties

declaredPolicies → Set<String>
The policies registered from @DVPolicy classes.
no setter
hashCode → int
The hash code for this object.
no setterinherited
overriddenPolicies → Set<String>
The declared policies the application registered its own answer for, which is the one asked.
no setter
registeredPolicies → Set<String>
Every registered policy, as action:ResourceType.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

acceptsCaller(String action, Object? user) → bool
Whether the policy for action, named as Resource.action, can be called with user as its caller and no resource.
authorize<TUser, TResource>(TUser user, String action, TResource resource) → Future<void>
can<TUser, TResource>(TUser user, String action, TResource resource) → Future<bool>
canAction(Object? user, String action, {Object? resource}) → Future<bool>
Whether user may action, named as Resource.action, optionally on resource.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register<TUser, TResource>(String action, DVPolicyCheck<TUser, TResource> check) → void
Registers the application's own answer for action on TResource.
registerAction(String action, FutureOr<bool> check(Object? caller, Object? resource)) → void
Registers the application's own answer for action, named as Resource.action, where there is no Dart type for the resource.
registerDeclared<TUser, TResource>(String action, DVPolicyCheck<TUser, TResource> check) → void
Registers a @DVPolicy class's method. Called by the generated client and server; the application's own register for the same action and resource is asked instead.
registerDeclaredAction(String action, FutureOr<bool> check(Object? caller, Object? resource)) → void
A framework default for action, asked only where the application registered nothing for it.
requiresCaller(String action) → bool
Whether the policy for action needs a caller: its user parameter is not nullable, so a request that authenticated nobody cannot be asked about. Judged on the user alone -- a policy that also needs a resource is refused for that, which signing in would not change. False for an action nothing registered.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

reset() → void
Forgets every registered policy. For a test: a process registers its policies once, at start.