784 lines
17 KiB
YAML
784 lines
17 KiB
YAML
name: Gate
|
|
class_comment: null
|
|
dependencies:
|
|
- name: Closure
|
|
type: class
|
|
source: Closure
|
|
- name: Exception
|
|
type: class
|
|
source: Exception
|
|
- name: GateEvaluated
|
|
type: class
|
|
source: Illuminate\Auth\Access\Events\GateEvaluated
|
|
- name: GateContract
|
|
type: class
|
|
source: Illuminate\Contracts\Auth\Access\Gate
|
|
- name: Container
|
|
type: class
|
|
source: Illuminate\Contracts\Container\Container
|
|
- name: Dispatcher
|
|
type: class
|
|
source: Illuminate\Contracts\Events\Dispatcher
|
|
- name: Arr
|
|
type: class
|
|
source: Illuminate\Support\Arr
|
|
- name: Collection
|
|
type: class
|
|
source: Illuminate\Support\Collection
|
|
- name: Str
|
|
type: class
|
|
source: Illuminate\Support\Str
|
|
- name: InvalidArgumentException
|
|
type: class
|
|
source: InvalidArgumentException
|
|
- name: ReflectionClass
|
|
type: class
|
|
source: ReflectionClass
|
|
- name: ReflectionFunction
|
|
type: class
|
|
source: ReflectionFunction
|
|
- name: HandlesAuthorization
|
|
type: class
|
|
source: HandlesAuthorization
|
|
properties:
|
|
- name: container
|
|
visibility: protected
|
|
comment: '# * The container instance.
|
|
|
|
# *
|
|
|
|
# * @var \Illuminate\Contracts\Container\Container'
|
|
- name: userResolver
|
|
visibility: protected
|
|
comment: '# * The user resolver callable.
|
|
|
|
# *
|
|
|
|
# * @var callable'
|
|
- name: abilities
|
|
visibility: protected
|
|
comment: '# * All of the defined abilities.
|
|
|
|
# *
|
|
|
|
# * @var array'
|
|
- name: policies
|
|
visibility: protected
|
|
comment: '# * All of the defined policies.
|
|
|
|
# *
|
|
|
|
# * @var array'
|
|
- name: beforeCallbacks
|
|
visibility: protected
|
|
comment: '# * All of the registered before callbacks.
|
|
|
|
# *
|
|
|
|
# * @var array'
|
|
- name: afterCallbacks
|
|
visibility: protected
|
|
comment: '# * All of the registered after callbacks.
|
|
|
|
# *
|
|
|
|
# * @var array'
|
|
- name: stringCallbacks
|
|
visibility: protected
|
|
comment: '# * All of the defined abilities using class@method notation.
|
|
|
|
# *
|
|
|
|
# * @var array'
|
|
- name: defaultDenialResponse
|
|
visibility: protected
|
|
comment: '# * The default denial response for gates and policies.
|
|
|
|
# *
|
|
|
|
# * @var \Illuminate\Auth\Access\Response|null'
|
|
- name: guessPolicyNamesUsingCallback
|
|
visibility: protected
|
|
comment: '# * The callback to be used to guess policy names.
|
|
|
|
# *
|
|
|
|
# * @var callable|null'
|
|
methods:
|
|
- name: __construct
|
|
visibility: public
|
|
parameters:
|
|
- name: container
|
|
- name: userResolver
|
|
- name: abilities
|
|
default: '[]'
|
|
- name: policies
|
|
default: '[]'
|
|
- name: beforeCallbacks
|
|
default: '[]'
|
|
- name: afterCallbacks
|
|
default: '[]'
|
|
- name: guessPolicyNamesUsingCallback
|
|
default: 'null'
|
|
comment: "# * The container instance.\n# *\n# * @var \\Illuminate\\Contracts\\Container\\\
|
|
Container\n# */\n# protected $container;\n# \n# /**\n# * The user resolver callable.\n\
|
|
# *\n# * @var callable\n# */\n# protected $userResolver;\n# \n# /**\n# * All of\
|
|
\ the defined abilities.\n# *\n# * @var array\n# */\n# protected $abilities =\
|
|
\ [];\n# \n# /**\n# * All of the defined policies.\n# *\n# * @var array\n# */\n\
|
|
# protected $policies = [];\n# \n# /**\n# * All of the registered before callbacks.\n\
|
|
# *\n# * @var array\n# */\n# protected $beforeCallbacks = [];\n# \n# /**\n# *\
|
|
\ All of the registered after callbacks.\n# *\n# * @var array\n# */\n# protected\
|
|
\ $afterCallbacks = [];\n# \n# /**\n# * All of the defined abilities using class@method\
|
|
\ notation.\n# *\n# * @var array\n# */\n# protected $stringCallbacks = [];\n#\
|
|
\ \n# /**\n# * The default denial response for gates and policies.\n# *\n# * @var\
|
|
\ \\Illuminate\\Auth\\Access\\Response|null\n# */\n# protected $defaultDenialResponse;\n\
|
|
# \n# /**\n# * The callback to be used to guess policy names.\n# *\n# * @var callable|null\n\
|
|
# */\n# protected $guessPolicyNamesUsingCallback;\n# \n# /**\n# * Create a new\
|
|
\ gate instance.\n# *\n# * @param \\Illuminate\\Contracts\\Container\\Container\
|
|
\ $container\n# * @param callable $userResolver\n# * @param array $abilities\n\
|
|
# * @param array $policies\n# * @param array $beforeCallbacks\n# * @param\
|
|
\ array $afterCallbacks\n# * @param callable|null $guessPolicyNamesUsingCallback\n\
|
|
# * @return void"
|
|
- name: has
|
|
visibility: public
|
|
parameters:
|
|
- name: ability
|
|
comment: '# * Determine if a given ability has been defined.
|
|
|
|
# *
|
|
|
|
# * @param string|array $ability
|
|
|
|
# * @return bool'
|
|
- name: allowIf
|
|
visibility: public
|
|
parameters:
|
|
- name: condition
|
|
- name: message
|
|
default: 'null'
|
|
- name: code
|
|
default: 'null'
|
|
comment: '# * Perform an on-demand authorization check. Throw an authorization exception
|
|
if the condition or callback is false.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Auth\Access\Response|\Closure|bool $condition
|
|
|
|
# * @param string|null $message
|
|
|
|
# * @param string|null $code
|
|
|
|
# * @return \Illuminate\Auth\Access\Response
|
|
|
|
# *
|
|
|
|
# * @throws \Illuminate\Auth\Access\AuthorizationException'
|
|
- name: denyIf
|
|
visibility: public
|
|
parameters:
|
|
- name: condition
|
|
- name: message
|
|
default: 'null'
|
|
- name: code
|
|
default: 'null'
|
|
comment: '# * Perform an on-demand authorization check. Throw an authorization exception
|
|
if the condition or callback is true.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Auth\Access\Response|\Closure|bool $condition
|
|
|
|
# * @param string|null $message
|
|
|
|
# * @param string|null $code
|
|
|
|
# * @return \Illuminate\Auth\Access\Response
|
|
|
|
# *
|
|
|
|
# * @throws \Illuminate\Auth\Access\AuthorizationException'
|
|
- name: authorizeOnDemand
|
|
visibility: protected
|
|
parameters:
|
|
- name: condition
|
|
- name: message
|
|
- name: code
|
|
- name: allowWhenResponseIs
|
|
comment: '# * Authorize a given condition or callback.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Auth\Access\Response|\Closure|bool $condition
|
|
|
|
# * @param string|null $message
|
|
|
|
# * @param string|null $code
|
|
|
|
# * @param bool $allowWhenResponseIs
|
|
|
|
# * @return \Illuminate\Auth\Access\Response
|
|
|
|
# *
|
|
|
|
# * @throws \Illuminate\Auth\Access\AuthorizationException'
|
|
- name: define
|
|
visibility: public
|
|
parameters:
|
|
- name: ability
|
|
- name: callback
|
|
comment: '# * Define a new ability.
|
|
|
|
# *
|
|
|
|
# * @param string $ability
|
|
|
|
# * @param callable|array|string $callback
|
|
|
|
# * @return $this
|
|
|
|
# *
|
|
|
|
# * @throws \InvalidArgumentException'
|
|
- name: resource
|
|
visibility: public
|
|
parameters:
|
|
- name: name
|
|
- name: class
|
|
- name: abilities
|
|
default: 'null'
|
|
comment: '# * Define abilities for a resource.
|
|
|
|
# *
|
|
|
|
# * @param string $name
|
|
|
|
# * @param string $class
|
|
|
|
# * @param array|null $abilities
|
|
|
|
# * @return $this'
|
|
- name: buildAbilityCallback
|
|
visibility: protected
|
|
parameters:
|
|
- name: ability
|
|
- name: callback
|
|
comment: '# * Create the ability callback for a callback string.
|
|
|
|
# *
|
|
|
|
# * @param string $ability
|
|
|
|
# * @param string $callback
|
|
|
|
# * @return \Closure'
|
|
- name: policy
|
|
visibility: public
|
|
parameters:
|
|
- name: class
|
|
- name: policy
|
|
comment: '# * Define a policy class for a given class type.
|
|
|
|
# *
|
|
|
|
# * @param string $class
|
|
|
|
# * @param string $policy
|
|
|
|
# * @return $this'
|
|
- name: before
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
comment: '# * Register a callback to run before all Gate checks.
|
|
|
|
# *
|
|
|
|
# * @param callable $callback
|
|
|
|
# * @return $this'
|
|
- name: after
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
comment: '# * Register a callback to run after all Gate checks.
|
|
|
|
# *
|
|
|
|
# * @param callable $callback
|
|
|
|
# * @return $this'
|
|
- name: allows
|
|
visibility: public
|
|
parameters:
|
|
- name: ability
|
|
- name: arguments
|
|
default: '[]'
|
|
comment: '# * Determine if all of the given abilities should be granted for the
|
|
current user.
|
|
|
|
# *
|
|
|
|
# * @param iterable|string $ability
|
|
|
|
# * @param array|mixed $arguments
|
|
|
|
# * @return bool'
|
|
- name: denies
|
|
visibility: public
|
|
parameters:
|
|
- name: ability
|
|
- name: arguments
|
|
default: '[]'
|
|
comment: '# * Determine if any of the given abilities should be denied for the current
|
|
user.
|
|
|
|
# *
|
|
|
|
# * @param iterable|string $ability
|
|
|
|
# * @param array|mixed $arguments
|
|
|
|
# * @return bool'
|
|
- name: check
|
|
visibility: public
|
|
parameters:
|
|
- name: abilities
|
|
- name: arguments
|
|
default: '[]'
|
|
comment: '# * Determine if all of the given abilities should be granted for the
|
|
current user.
|
|
|
|
# *
|
|
|
|
# * @param iterable|string $abilities
|
|
|
|
# * @param array|mixed $arguments
|
|
|
|
# * @return bool'
|
|
- name: any
|
|
visibility: public
|
|
parameters:
|
|
- name: abilities
|
|
- name: arguments
|
|
default: '[]'
|
|
comment: '# * Determine if any one of the given abilities should be granted for
|
|
the current user.
|
|
|
|
# *
|
|
|
|
# * @param iterable|string $abilities
|
|
|
|
# * @param array|mixed $arguments
|
|
|
|
# * @return bool'
|
|
- name: none
|
|
visibility: public
|
|
parameters:
|
|
- name: abilities
|
|
- name: arguments
|
|
default: '[]'
|
|
comment: '# * Determine if all of the given abilities should be denied for the current
|
|
user.
|
|
|
|
# *
|
|
|
|
# * @param iterable|string $abilities
|
|
|
|
# * @param array|mixed $arguments
|
|
|
|
# * @return bool'
|
|
- name: authorize
|
|
visibility: public
|
|
parameters:
|
|
- name: ability
|
|
- name: arguments
|
|
default: '[]'
|
|
comment: '# * Determine if the given ability should be granted for the current user.
|
|
|
|
# *
|
|
|
|
# * @param string $ability
|
|
|
|
# * @param array|mixed $arguments
|
|
|
|
# * @return \Illuminate\Auth\Access\Response
|
|
|
|
# *
|
|
|
|
# * @throws \Illuminate\Auth\Access\AuthorizationException'
|
|
- name: inspect
|
|
visibility: public
|
|
parameters:
|
|
- name: ability
|
|
- name: arguments
|
|
default: '[]'
|
|
comment: '# * Inspect the user for the given ability.
|
|
|
|
# *
|
|
|
|
# * @param string $ability
|
|
|
|
# * @param array|mixed $arguments
|
|
|
|
# * @return \Illuminate\Auth\Access\Response'
|
|
- name: raw
|
|
visibility: public
|
|
parameters:
|
|
- name: ability
|
|
- name: arguments
|
|
default: '[]'
|
|
comment: '# * Get the raw result from the authorization callback.
|
|
|
|
# *
|
|
|
|
# * @param string $ability
|
|
|
|
# * @param array|mixed $arguments
|
|
|
|
# * @return mixed
|
|
|
|
# *
|
|
|
|
# * @throws \Illuminate\Auth\Access\AuthorizationException'
|
|
- name: canBeCalledWithUser
|
|
visibility: protected
|
|
parameters:
|
|
- name: user
|
|
- name: class
|
|
- name: method
|
|
default: 'null'
|
|
comment: '# * Determine whether the callback/method can be called with the given
|
|
user.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Auth\Authenticatable|null $user
|
|
|
|
# * @param \Closure|string|array $class
|
|
|
|
# * @param string|null $method
|
|
|
|
# * @return bool'
|
|
- name: methodAllowsGuests
|
|
visibility: protected
|
|
parameters:
|
|
- name: class
|
|
- name: method
|
|
comment: '# * Determine if the given class method allows guests.
|
|
|
|
# *
|
|
|
|
# * @param string $class
|
|
|
|
# * @param string $method
|
|
|
|
# * @return bool'
|
|
- name: callbackAllowsGuests
|
|
visibility: protected
|
|
parameters:
|
|
- name: callback
|
|
comment: '# * Determine if the callback allows guests.
|
|
|
|
# *
|
|
|
|
# * @param callable $callback
|
|
|
|
# * @return bool
|
|
|
|
# *
|
|
|
|
# * @throws \ReflectionException'
|
|
- name: parameterAllowsGuests
|
|
visibility: protected
|
|
parameters:
|
|
- name: parameter
|
|
comment: '# * Determine if the given parameter allows guests.
|
|
|
|
# *
|
|
|
|
# * @param \ReflectionParameter $parameter
|
|
|
|
# * @return bool'
|
|
- name: callAuthCallback
|
|
visibility: protected
|
|
parameters:
|
|
- name: user
|
|
- name: ability
|
|
- name: arguments
|
|
comment: '# * Resolve and call the appropriate authorization callback.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Auth\Authenticatable|null $user
|
|
|
|
# * @param string $ability
|
|
|
|
# * @param array $arguments
|
|
|
|
# * @return bool'
|
|
- name: callBeforeCallbacks
|
|
visibility: protected
|
|
parameters:
|
|
- name: user
|
|
- name: ability
|
|
- name: arguments
|
|
comment: '# * Call all of the before callbacks and return if a result is given.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Auth\Authenticatable|null $user
|
|
|
|
# * @param string $ability
|
|
|
|
# * @param array $arguments
|
|
|
|
# * @return bool|null'
|
|
- name: callAfterCallbacks
|
|
visibility: protected
|
|
parameters:
|
|
- name: user
|
|
- name: ability
|
|
- name: arguments
|
|
- name: result
|
|
comment: '# * Call all of the after callbacks with check result.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Auth\Authenticatable $user
|
|
|
|
# * @param string $ability
|
|
|
|
# * @param array $arguments
|
|
|
|
# * @param bool $result
|
|
|
|
# * @return bool|null'
|
|
- name: dispatchGateEvaluatedEvent
|
|
visibility: protected
|
|
parameters:
|
|
- name: user
|
|
- name: ability
|
|
- name: arguments
|
|
- name: result
|
|
comment: '# * Dispatch a gate evaluation event.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Auth\Authenticatable|null $user
|
|
|
|
# * @param string $ability
|
|
|
|
# * @param array $arguments
|
|
|
|
# * @param bool|null $result
|
|
|
|
# * @return void'
|
|
- name: resolveAuthCallback
|
|
visibility: protected
|
|
parameters:
|
|
- name: user
|
|
- name: ability
|
|
- name: arguments
|
|
comment: '# * Resolve the callable for the given ability and arguments.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Auth\Authenticatable|null $user
|
|
|
|
# * @param string $ability
|
|
|
|
# * @param array $arguments
|
|
|
|
# * @return callable'
|
|
- name: getPolicyFor
|
|
visibility: public
|
|
parameters:
|
|
- name: class
|
|
comment: '# * Get a policy instance for a given class.
|
|
|
|
# *
|
|
|
|
# * @param object|string $class
|
|
|
|
# * @return mixed'
|
|
- name: guessPolicyName
|
|
visibility: protected
|
|
parameters:
|
|
- name: class
|
|
comment: '# * Guess the policy name for the given class.
|
|
|
|
# *
|
|
|
|
# * @param string $class
|
|
|
|
# * @return array'
|
|
- name: guessPolicyNamesUsing
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
comment: '# * Specify a callback to be used to guess policy names.
|
|
|
|
# *
|
|
|
|
# * @param callable $callback
|
|
|
|
# * @return $this'
|
|
- name: resolvePolicy
|
|
visibility: public
|
|
parameters:
|
|
- name: class
|
|
comment: '# * Build a policy class instance of the given type.
|
|
|
|
# *
|
|
|
|
# * @param object|string $class
|
|
|
|
# * @return mixed
|
|
|
|
# *
|
|
|
|
# * @throws \Illuminate\Contracts\Container\BindingResolutionException'
|
|
- name: resolvePolicyCallback
|
|
visibility: protected
|
|
parameters:
|
|
- name: user
|
|
- name: ability
|
|
- name: arguments
|
|
- name: policy
|
|
comment: '# * Resolve the callback for a policy check.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Auth\Authenticatable $user
|
|
|
|
# * @param string $ability
|
|
|
|
# * @param array $arguments
|
|
|
|
# * @param mixed $policy
|
|
|
|
# * @return bool|callable'
|
|
- name: callPolicyBefore
|
|
visibility: protected
|
|
parameters:
|
|
- name: policy
|
|
- name: user
|
|
- name: ability
|
|
- name: arguments
|
|
comment: '# * Call the "before" method on the given policy, if applicable.
|
|
|
|
# *
|
|
|
|
# * @param mixed $policy
|
|
|
|
# * @param \Illuminate\Contracts\Auth\Authenticatable $user
|
|
|
|
# * @param string $ability
|
|
|
|
# * @param array $arguments
|
|
|
|
# * @return mixed'
|
|
- name: callPolicyMethod
|
|
visibility: protected
|
|
parameters:
|
|
- name: policy
|
|
- name: method
|
|
- name: user
|
|
- name: arguments
|
|
comment: '# * Call the appropriate method on the given policy.
|
|
|
|
# *
|
|
|
|
# * @param mixed $policy
|
|
|
|
# * @param string $method
|
|
|
|
# * @param \Illuminate\Contracts\Auth\Authenticatable|null $user
|
|
|
|
# * @param array $arguments
|
|
|
|
# * @return mixed'
|
|
- name: formatAbilityToMethod
|
|
visibility: protected
|
|
parameters:
|
|
- name: ability
|
|
comment: '# * Format the policy ability into a method name.
|
|
|
|
# *
|
|
|
|
# * @param string $ability
|
|
|
|
# * @return string'
|
|
- name: forUser
|
|
visibility: public
|
|
parameters:
|
|
- name: user
|
|
comment: '# * Get a gate instance for the given user.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user
|
|
|
|
# * @return static'
|
|
- name: resolveUser
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * Resolve the user from the user resolver.
|
|
|
|
# *
|
|
|
|
# * @return mixed'
|
|
- name: abilities
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Get all of the defined abilities.
|
|
|
|
# *
|
|
|
|
# * @return array'
|
|
- name: policies
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Get all of the defined policies.
|
|
|
|
# *
|
|
|
|
# * @return array'
|
|
- name: defaultDenialResponse
|
|
visibility: public
|
|
parameters:
|
|
- name: response
|
|
comment: '# * Set the default denial response for gates and policies.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Auth\Access\Response $response
|
|
|
|
# * @return $this'
|
|
- name: setContainer
|
|
visibility: public
|
|
parameters:
|
|
- name: container
|
|
comment: '# * Set the container instance used by the gate.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Container\Container $container
|
|
|
|
# * @return $this'
|
|
traits:
|
|
- Closure
|
|
- Exception
|
|
- Illuminate\Auth\Access\Events\GateEvaluated
|
|
- Illuminate\Contracts\Container\Container
|
|
- Illuminate\Contracts\Events\Dispatcher
|
|
- Illuminate\Support\Arr
|
|
- Illuminate\Support\Collection
|
|
- Illuminate\Support\Str
|
|
- InvalidArgumentException
|
|
- ReflectionClass
|
|
- ReflectionFunction
|
|
- HandlesAuthorization
|
|
interfaces:
|
|
- GateContract
|