CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C Authorization 3.x API

  • Project:
    • Authorization
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.x
      • 3.x
      • 2.x

Namespaces

  • Authorization
    • Command
    • Controller
    • Exception
    • Middleware
    • Policy
      • Exception

Class ResolverCollection

ResolverCollection is used for aggregating multiple resolvers when more than one resolver is necessary. The collection will iterate over configured resolvers and try to resolve a policy on each one. The first successfully resolved policy will be returned.

Configured resolvers must throw Authorization\Policy\Exception\MissingPolicyException if a policy cannot be resolved.

Example configuration:

$collection = new ResolverCollection([
    new OrmResolver(),
    new MapResolver([
        Service::class => ServicePolicy::class
    ])
]);

$service = new AuthorizationService($collection);
Namespace: Authorization\Policy

Property Summary

  • $resolvers protected
    array<Authorization\Policy\ResolverInterface>

    Policy resolver instances.

Method Summary

  • __construct() public

    Constructor. Takes an array of policy resolver instances.

  • add() public

    Adds a resolver to the collection.

  • getPolicy() public

    Resolves the policy object based on the authorization resource.

Method Detail

__construct() ¶ public

__construct(array<Authorization\Policy\ResolverInterface> $resolvers = [])

Constructor. Takes an array of policy resolver instances.

Parameters
array<Authorization\Policy\ResolverInterface> $resolvers optional

An array of policy resolver instances.

add() ¶ public

add(Authorization\Policy\ResolverInterface $resolver): $this

Adds a resolver to the collection.

Parameters
Authorization\Policy\ResolverInterface $resolver

Resolver instance.

Returns
$this

getPolicy() ¶ public

getPolicy(mixed $resource): mixed

Resolves the policy object based on the authorization resource.

The resolver MUST throw the \Authorization\Policy\Exception\MissingPolicyException exception if a policy cannot be resolved for a given resource.

Parameters
mixed $resource
Returns
mixed

Property Detail

$resolvers ¶ protected

Policy resolver instances.

Type
array<Authorization\Policy\ResolverInterface>
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs