mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-08-04 07:03:41 +02:00
Upgrade CakePHP from 2.2.5 to 2.9.5
This commit is contained in:
parent
5a580df460
commit
235a541597
793 changed files with 60746 additions and 23753 deletions
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('Hash', 'Utility');
|
||||
|
||||
/**
|
||||
|
@ -40,10 +40,10 @@ abstract class BaseAuthorize {
|
|||
/**
|
||||
* Settings for authorize objects.
|
||||
*
|
||||
* - `actionPath` - The path to ACO nodes that contains the nodes for controllers. Used as a prefix
|
||||
* - `actionPath` - The path to ACO nodes that contains the nodes for controllers. Used as a prefix
|
||||
* when calling $this->action();
|
||||
* - `actionMap` - Action -> crud mappings. Used by authorization objects that want to map actions to CRUD roles.
|
||||
* - `userModel` - Model name that ARO records can be found under. Defaults to 'User'.
|
||||
* - `userModel` - Model name that ARO records can be found under. Defaults to 'User'.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
@ -64,7 +64,7 @@ abstract class BaseAuthorize {
|
|||
* Constructor
|
||||
*
|
||||
* @param ComponentCollection $collection The controller for this request.
|
||||
* @param string $settings An array of settings. This class does not use any settings.
|
||||
* @param string $settings An array of settings. This class does not use any settings.
|
||||
*/
|
||||
public function __construct(ComponentCollection $collection, $settings = array()) {
|
||||
$this->_Collection = $collection;
|
||||
|
@ -77,8 +77,8 @@ abstract class BaseAuthorize {
|
|||
* Checks user authorization.
|
||||
*
|
||||
* @param array $user Active user data
|
||||
* @param CakeRequest $request
|
||||
* @return boolean
|
||||
* @param CakeRequest $request Request instance.
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function authorize($user, CakeRequest $request);
|
||||
|
||||
|
@ -101,14 +101,14 @@ abstract class BaseAuthorize {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the action path for a given request. Primarily used by authorize objects
|
||||
* 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.
|
||||
*
|
||||
* @param CakeRequest $request The request a path is needed for.
|
||||
* @param string $path
|
||||
* @param string $path Path format.
|
||||
* @return string the action path for the given request.
|
||||
*/
|
||||
public function action($request, $path = '/:plugin/:controller/:action') {
|
||||
public function action(CakeRequest $request, $path = '/:plugin/:controller/:action') {
|
||||
$plugin = empty($request['plugin']) ? null : Inflector::camelize($request['plugin']) . '/';
|
||||
$path = str_replace(
|
||||
array(':controller', ':action', ':plugin/'),
|
||||
|
@ -120,24 +120,31 @@ abstract class BaseAuthorize {
|
|||
}
|
||||
|
||||
/**
|
||||
* Maps crud actions to actual action names. Used to modify or get the current mapped actions.
|
||||
* 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'));
|
||||
* }}}
|
||||
* ```
|
||||
*
|
||||
* Or equivalently:
|
||||
*
|
||||
* ```
|
||||
* $this->Auth->mapActions(array('register' => 'create', 'add' => 'create'));
|
||||
* ```
|
||||
*
|
||||
* Create mappings for custom CRUD operations:
|
||||
*
|
||||
* {{{
|
||||
* $this->Auth->mapActions(array('my_action' => 'admin'));
|
||||
* }}}
|
||||
* ```
|
||||
* $this->Auth->mapActions(array('range' => 'search'));
|
||||
* ```
|
||||
*
|
||||
* 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.
|
||||
* that behave like CRUD operations. Doing this will require additional columns on the
|
||||
* permissions lookup. For example if one wanted an additional search CRUD operation
|
||||
* one would create and additional column '_search' in the aros_acos table. One could
|
||||
* create a custom admin CRUD operation for administration functions similarly if needed.
|
||||
*
|
||||
* @param array $map Either an array of mappings, or undefined to get current values.
|
||||
* @return mixed Either the current mappings or null when setting.
|
||||
|
@ -147,9 +154,8 @@ abstract class BaseAuthorize {
|
|||
if (empty($map)) {
|
||||
return $this->settings['actionMap'];
|
||||
}
|
||||
$crud = array('create', 'read', 'update', 'delete');
|
||||
foreach ($map as $action => $type) {
|
||||
if (in_array($action, $crud) && is_array($type)) {
|
||||
if (is_array($type)) {
|
||||
foreach ($type as $typedAction) {
|
||||
$this->settings['actionMap'][$typedAction] = $action;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue