AuthorizationGate class final
Ability registry and checker (Laravel Gate). One instance per
application; forUser yields a view bound to a specific user.
Constructors
-
AuthorizationGate({Future<
Authenticatable?> userResolver()?})
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
-
after(
GateAfterHook hook) → void -
allows(
String ability, [List< Object?> args = const []]) → Future<bool> -
any(
Iterable< String> abilities, [List<Object?> args = const []]) → Future<bool> - At least one ability allowed.
- Throws AuthorizationException (403) when denied.
-
before(
GateBeforeHook hook) → void -
check(
Iterable< String> abilities, [List<Object?> args = const []]) → Future<bool> - Every ability allowed.
-
define(
String ability, GateCallback callback) → void - Registers an ability.
-
denies(
String ability, [List< Object?> args = const []]) → Future<bool> -
forUser(
Authenticatable? user) → AuthorizationGate -
A gate that checks abilities for
userinstead of the current user. -
has(
String ability) → bool -
inspect(
String ability, [List< Object?> args = const []]) → Future<AuthResponse> - Full result with message/code.
-
none(
Iterable< String> abilities, [List<Object?> args = const []]) → Future<bool> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
policy<
T extends Object> (Policy< T> policy) → void -
Registers
policyfor instances (and the Type) ofT. The first policy whose type matches an instance (ischeck) wins, so register subclasses before their parents. -
policyFor(
Object? target) → Policy< Object> ? -
Finds the policy registered for
target(an instance or a Type). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited