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 2.x API

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

Namespaces

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

Interface AuthorizationServiceInterface

Interface for Authorization service

Namespace: Authorization

Method Summary

  • applyScope() public

    Apply authorization scope conditions/restrictions.

  • authorizationChecked() public

    Return a boolean based on whether or not this object has had an authorization operation performed.

  • can() public

    Check whether the provided user can perform an action on a resource.

  • canResult() public

    Check whether the provided user can perform an action on a resource.

  • skipAuthorization() public

    Allow for authorization to be skipped for this object.

Method Detail

applyScope() ¶ public

applyScope(Authorization\IdentityInterface|null $user, string $action, mixed $resource): mixed

Apply authorization scope conditions/restrictions.

This method is intended for applying authorization to objects that are then used to access authorized collections of objects. The typical use case for scopes are restricting a query to only return records visible to the current user.

Parameters
Authorization\IdentityInterface|null $user

The user to check permissions for.

string $action

The action/operation being performed.

mixed $resource

The resource being operated on.

Returns
mixed

authorizationChecked() ¶ public

authorizationChecked(): bool

Return a boolean based on whether or not this object has had an authorization operation performed.

Returns
bool

can() ¶ public

can(Authorization\IdentityInterface|null $user, string $action, mixed $resource): bool

Check whether the provided user can perform an action on a resource.

This method is intended to allow your application to build conditional logic around authorization checks.

Parameters
Authorization\IdentityInterface|null $user

The user to check permissions for.

string $action

The action/operation being performed.

mixed $resource

The resource being operated on.

Returns
bool

canResult() ¶ public

canResult(Authorization\IdentityInterface|null $user, string $action, mixed $resource): Authorization\Policy\ResultInterface

Check whether the provided user can perform an action on a resource.

This method is intended to allow your application to build conditional logic around authorization checks.

Parameters
Authorization\IdentityInterface|null $user

The user to check permissions for.

string $action

The action/operation being performed.

mixed $resource

The resource being operated on.

Returns
Authorization\Policy\ResultInterface

skipAuthorization() ¶ public

skipAuthorization(): $this

Allow for authorization to be skipped for this object.

After calling this method the value of authorizationChecked() should return true regardless of whether authorization has been performed or not.

Returns
$this
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