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
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.1 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.1
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
    • Network
      • Email
      • Http
    • Routing
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • ActionsAuthorize
  • BaseAuthenticate
  • BaseAuthorize
  • BasicAuthenticate
  • ControllerAuthorize
  • CrudAuthorize
  • DigestAuthenticate
  • FormAuthenticate

Class CrudAuthorize

An authorization adapter for AuthComponent. Provides the ability to authorize using CRUD mappings. CRUD mappings allow you to translate controller actions into Create Read Update Delete actions. This is then checked in the AclComponent as specific permissions.

For example, taking /posts/index as the current request. The default mapping for index, is a read permission check. The Acl check would then be for the posts controller with the read permission. This allows you to create permission systems that focus more on what is being done to resources, rather than the specific actions being visited.

BaseAuthorize
Extended by CrudAuthorize
Package: Cake\Controller\Component\Auth
Since: 2.0
See: AuthComponent::$authenticate
See: AclComponent::check()
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/Controller/Component/Auth/CrudAuthorize.php

Inherited Properties

  • _Collection, _Controller, settings

Method Summary

  • __construct() public
    Sets up additional actionMap values that match the configured Routing.prefixes.
  • _setPrefixMappings() protected
    sets the crud mappings for prefix routes.
  • authorize() public
    Authorize a user using the mapped actions and the AclComponent.

Method Detail

__construct() public ¶

__construct( ComponentCollection $collection , string $settings = array() )

Sets up additional actionMap values that match the configured Routing.prefixes.

Parameters
ComponentCollection $collection
The component collection from the controller.
string $settings optional array()
An array of settings. This class does not use any settings.
Overrides
BaseAuthorize::__construct()

_setPrefixMappings() protected ¶

_setPrefixMappings( )

sets the crud mappings for prefix routes.

authorize() public ¶

authorize( array $user , CakeRequest $request )

Authorize a user using the mapped actions and the AclComponent.

Parameters
array $user
The user to authorize
CakeRequest $request
The request needing authorization.
Returns
boolean

Methods inherited from BaseAuthorize

action() public ¶

action( CakeRequest $request , string $path = '/:plugin/:controller/:action' )

Get the action path for a given request. Primarily used by authorize objects that need to get information about the plugin, controller, and action being invoked.

Parameters
CakeRequest $request
The request a path is needed for.
string $path optional '/:plugin/:controller/:action'
Returns
string
the action path for the given request.

controller() public ¶

controller( Controller $controller = null )

Accessor to the controller object.

Parameters
Controller $controller optional null
null to get, a controller to set.
Returns
mixed
Throws
CakeException

mapActions() public ¶

mapActions( mixed $map = array() )

Maps crud actions to actual action names. Used to modify or get the current mapped actions.

Create additional mappings for a standard CRUD operation:

{{{ $this->Auth->mapActions(array('create' => array('add', 'register')); }}}

Create mappings for custom CRUD operations:

{{{ $this->Auth->mapActions(array('my_action' => 'admin')); }}}

You can use the custom CRUD operations to create additional generic permissions that behave like CRUD operations. Doing this will require additional columns on the permissions lookup. When using with DbAcl, you'll have to add additional _admin type columns to the aros_acos table.

Parameters
mixed $map optional array()
Either an array of mappings, or undefined to get current values.
Returns
mixed
Either the current mappings or null when setting.
See
AuthComponent::mapActions()
OpenHub
Rackspace
Rackspace
  • 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
  • Slack
  • Paid Support

Generated using CakePHP API Docs