Authorization (Gate::allows, Gate::authorize).
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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
Static Properties
- gate → AuthorizationGate
-
The gate of the current container.
no setter
Static Methods
-
after(
GateAfterHook hook) → void -
Runs
hookafter every check. -
allows(
String ability, [List< Object?> args = const []]) → Future<bool> -
Whether the authenticated user may do
abilitywithargs. -
any(
Iterable< String> abilities, [List<Object?> args = const []]) → Future<bool> - Whether any of the abilities is allowed.
-
Allows
abilityor throws a 403 with the policy's message. -
before(
GateBeforeHook hook) → void -
Runs
hookbefore every check; a non-null result decides it. -
check(
Iterable< String> abilities, [List<Object?> args = const []]) → Future<bool> - Whether every one of the abilities is allowed.
-
define(
String ability, GateCallback callback) → void -
Defines
ability:Gate.define('edit-post', (user, [post]) => ...). -
denies(
String ability, [List< Object?> args = const []]) → Future<bool> -
Whether the authenticated user may not do
ability. -
forUser(
Authenticatable? user) → AuthorizationGate -
The gate checking as
userinstead of the authenticated one. -
has(
String ability) → bool -
Whether
abilityis defined. -
inspect(
String ability, [List< Object?> args = const []]) → Future<AuthResponse> -
The full answer for
ability: allowed or denied, with a message and code. -
none(
Iterable< String> abilities, [List<Object?> args = const []]) → Future<bool> - Whether none of the abilities is allowed.
-
policy<
T extends Object> (Policy< T> policy) → void -
Registers
policyfor its model type.