mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-10-30 15:53:59 +01: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,16 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* 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
|
||||
* @package Cake.Controller.Component.Acl
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -27,6 +28,7 @@ interface AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return bool Success
|
||||
*/
|
||||
public function check($aro, $aco, $action = "*");
|
||||
|
||||
|
|
@ -36,7 +38,7 @@ interface AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
*/
|
||||
public function allow($aro, $aco, $action = "*");
|
||||
|
||||
|
|
@ -46,7 +48,7 @@ interface AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
*/
|
||||
public function deny($aro, $aco, $action = "*");
|
||||
|
||||
|
|
@ -56,14 +58,15 @@ interface AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
*/
|
||||
public function inherit($aro, $aco, $action = "*");
|
||||
|
||||
/**
|
||||
* Initialization method for the Acl implementation
|
||||
*
|
||||
* @param AclComponent $component
|
||||
* @param Component $component The AclComponent instance.
|
||||
* @return void
|
||||
*/
|
||||
public function initialize(Component $component);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* 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
|
||||
* @package Cake.Controller.Component.Acl
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('AclInterface', 'Controller/Component/Acl');
|
||||
App::uses('Hash', 'Utility');
|
||||
App::uses('ClassRegistry', 'Utility');
|
||||
|
||||
/**
|
||||
* DbAcl implements an ACL control system in the database. ARO's and ACO's are
|
||||
* structured into trees and a linking table is used to define permissions. You
|
||||
* DbAcl implements an ACL control system in the database. ARO's and ACO's are
|
||||
* structured into trees and a linking table is used to define permissions. You
|
||||
* can install the schema for DbAcl with the Schema Shell.
|
||||
*
|
||||
* `$aco` and `$aro` parameters can be slash delimited paths to tree nodes.
|
||||
|
|
@ -26,19 +29,18 @@ App::uses('Hash', 'Utility');
|
|||
*
|
||||
* Would point to a tree structure like
|
||||
*
|
||||
* {{{
|
||||
* ```
|
||||
* controllers
|
||||
* Users
|
||||
* edit
|
||||
* }}}
|
||||
* ```
|
||||
*
|
||||
* @package Cake.Controller.Component.Acl
|
||||
*/
|
||||
class DbAcl extends Object implements AclInterface {
|
||||
class DbAcl extends CakeObject implements AclInterface {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
|
@ -50,7 +52,7 @@ class DbAcl extends Object implements AclInterface {
|
|||
/**
|
||||
* Initializes the containing component and sets the Aro/Aco objects to it.
|
||||
*
|
||||
* @param AclComponent $component
|
||||
* @param AclComponent $component The AclComponent instance.
|
||||
* @return void
|
||||
*/
|
||||
public function initialize(Component $component) {
|
||||
|
|
@ -64,7 +66,7 @@ class DbAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success (true if ARO has access to action in ACO, false otherwise)
|
||||
* @return bool Success (true if ARO has access to action in ACO, false otherwise)
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/access-control-lists.html#checking-permissions-the-acl-component
|
||||
*/
|
||||
public function check($aro, $aco, $action = "*") {
|
||||
|
|
@ -77,8 +79,8 @@ class DbAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $actions Action (defaults to *)
|
||||
* @param integer $value Value to indicate access type (1 to give access, -1 to deny, 0 to inherit)
|
||||
* @return boolean Success
|
||||
* @param int $value Value to indicate access type (1 to give access, -1 to deny, 0 to inherit)
|
||||
* @return bool Success
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/access-control-lists.html#assigning-permissions
|
||||
*/
|
||||
public function allow($aro, $aco, $actions = "*", $value = 1) {
|
||||
|
|
@ -91,7 +93,7 @@ class DbAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/access-control-lists.html#assigning-permissions
|
||||
*/
|
||||
public function deny($aro, $aco, $action = "*") {
|
||||
|
|
@ -104,7 +106,7 @@ class DbAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
*/
|
||||
public function inherit($aro, $aco, $action = "*") {
|
||||
return $this->allow($aro, $aco, $action, 0);
|
||||
|
|
@ -116,7 +118,7 @@ class DbAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
* @see allow()
|
||||
*/
|
||||
public function grant($aro, $aco, $action = "*") {
|
||||
|
|
@ -129,7 +131,7 @@ class DbAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
* @see deny()
|
||||
*/
|
||||
public function revoke($aro, $aco, $action = "*") {
|
||||
|
|
|
|||
|
|
@ -1,26 +1,28 @@
|
|||
<?php
|
||||
/**
|
||||
* 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
|
||||
* @package Cake.Controller.Component.Acl
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('AclInterface', 'Controller/Component/Acl');
|
||||
|
||||
/**
|
||||
* IniAcl implements an access control system using an INI file. An example
|
||||
* IniAcl implements an access control system using an INI file. An example
|
||||
* of the ini file used can be found in /config/acl.ini.php.
|
||||
*
|
||||
* @package Cake.Controller.Component.Acl
|
||||
*/
|
||||
class IniAcl extends Object implements AclInterface {
|
||||
class IniAcl extends CakeObject implements AclInterface {
|
||||
|
||||
/**
|
||||
* Array with configuration, parsed from ini file
|
||||
|
|
@ -31,7 +33,7 @@ class IniAcl extends Object implements AclInterface {
|
|||
|
||||
/**
|
||||
* The Hash::extract() path to the user/aro identifier in the
|
||||
* acl.ini file. This path will be used to extract the string
|
||||
* acl.ini file. This path will be used to extract the string
|
||||
* representation of a user used in the ini file.
|
||||
*
|
||||
* @var string
|
||||
|
|
@ -41,7 +43,7 @@ class IniAcl extends Object implements AclInterface {
|
|||
/**
|
||||
* Initialize method
|
||||
*
|
||||
* @param AclBase $component
|
||||
* @param Component $component The AclComponent instance.
|
||||
* @return void
|
||||
*/
|
||||
public function initialize(Component $component) {
|
||||
|
|
@ -53,7 +55,7 @@ class IniAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
*/
|
||||
public function allow($aro, $aco, $action = "*") {
|
||||
}
|
||||
|
|
@ -64,7 +66,7 @@ class IniAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
*/
|
||||
public function deny($aro, $aco, $action = "*") {
|
||||
}
|
||||
|
|
@ -75,7 +77,7 @@ class IniAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
*/
|
||||
public function inherit($aro, $aco, $action = "*") {
|
||||
}
|
||||
|
|
@ -88,10 +90,10 @@ class IniAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO
|
||||
* @param string $aco ACO
|
||||
* @param string $action Action
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
*/
|
||||
public function check($aro, $aco, $action = null) {
|
||||
if ($this->config == null) {
|
||||
if (!$this->config) {
|
||||
$this->config = $this->readConfigFile(APP . 'Config' . DS . 'acl.ini.php');
|
||||
}
|
||||
$aclConfig = $this->config;
|
||||
|
|
|
|||
|
|
@ -2,19 +2,18 @@
|
|||
/**
|
||||
* PHP configuration based AclInterface implementation
|
||||
*
|
||||
* 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
|
||||
* @package Cake.Controller.Component.Acl
|
||||
* @since CakePHP(tm) v 2.1
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -23,9 +22,20 @@
|
|||
*
|
||||
* @package Cake.Controller.Component.Acl
|
||||
*/
|
||||
class PhpAcl extends Object implements AclInterface {
|
||||
class PhpAcl extends CakeObject implements AclInterface {
|
||||
|
||||
/**
|
||||
* Constant for deny
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
const DENY = false;
|
||||
|
||||
/**
|
||||
* Constant for allow
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
const ALLOW = true;
|
||||
|
||||
/**
|
||||
|
|
@ -58,7 +68,7 @@ class PhpAcl extends Object implements AclInterface {
|
|||
*/
|
||||
public function __construct() {
|
||||
$this->options = array(
|
||||
'policy' => self::DENY,
|
||||
'policy' => static::DENY,
|
||||
'config' => APP . 'Config' . DS . 'acl.php',
|
||||
);
|
||||
}
|
||||
|
|
@ -71,7 +81,7 @@ class PhpAcl extends Object implements AclInterface {
|
|||
*/
|
||||
public function initialize(Component $Component) {
|
||||
if (!empty($Component->settings['adapter'])) {
|
||||
$this->options = array_merge($this->options, $Component->settings['adapter']);
|
||||
$this->options = $Component->settings['adapter'] + $this->options;
|
||||
}
|
||||
|
||||
App::uses('PhpReader', 'Configure');
|
||||
|
|
@ -91,11 +101,11 @@ class PhpAcl extends Object implements AclInterface {
|
|||
*/
|
||||
public function build(array $config) {
|
||||
if (empty($config['roles'])) {
|
||||
throw new AclException(__d('cake_dev','"roles" section not found in configuration.'));
|
||||
throw new AclException(__d('cake_dev', '"roles" section not found in configuration.'));
|
||||
}
|
||||
|
||||
if (empty($config['rules']['allow']) && empty($config['rules']['deny'])) {
|
||||
throw new AclException(__d('cake_dev','Neither "allow" nor "deny" rules were provided in configuration.'));
|
||||
throw new AclException(__d('cake_dev', 'Neither "allow" nor "deny" rules were provided in configuration.'));
|
||||
}
|
||||
|
||||
$rules['allow'] = !empty($config['rules']['allow']) ? $config['rules']['allow'] : array();
|
||||
|
|
@ -114,7 +124,7 @@ class PhpAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
*/
|
||||
public function allow($aro, $aco, $action = "*") {
|
||||
return $this->Aco->access($this->Aro->resolve($aro), $aco, $action, 'allow');
|
||||
|
|
@ -126,7 +136,7 @@ class PhpAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
*/
|
||||
public function deny($aro, $aco, $action = "*") {
|
||||
return $this->Aco->access($this->Aro->resolve($aro), $aco, $action, 'deny');
|
||||
|
|
@ -138,7 +148,7 @@ class PhpAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO The requesting object identifier.
|
||||
* @param string $aco ACO The controlled object identifier.
|
||||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
*/
|
||||
public function inherit($aro, $aco, $action = "*") {
|
||||
return false;
|
||||
|
|
@ -151,13 +161,13 @@ class PhpAcl extends Object implements AclInterface {
|
|||
* @param string $aro ARO
|
||||
* @param string $aco ACO
|
||||
* @param string $action Action
|
||||
* @return boolean true if access is granted, false otherwise
|
||||
* @return bool true if access is granted, false otherwise
|
||||
*/
|
||||
public function check($aro, $aco, $action = "*") {
|
||||
$allow = $this->options['policy'];
|
||||
$prioritizedAros = $this->Aro->roles($aro);
|
||||
|
||||
if ($action && $action != "*") {
|
||||
if ($action && $action !== "*") {
|
||||
$aco .= '/' . $action;
|
||||
}
|
||||
|
||||
|
|
@ -167,14 +177,14 @@ class PhpAcl extends Object implements AclInterface {
|
|||
return $allow;
|
||||
}
|
||||
|
||||
foreach ($path as $depth => $node) {
|
||||
foreach ($path as $node) {
|
||||
foreach ($prioritizedAros as $aros) {
|
||||
if (!empty($node['allow'])) {
|
||||
$allow = $allow || count(array_intersect($node['allow'], $aros)) > 0;
|
||||
$allow = $allow || count(array_intersect($node['allow'], $aros));
|
||||
}
|
||||
|
||||
if (!empty($node['deny'])) {
|
||||
$allow = $allow && count(array_intersect($node['deny'], $aros)) == 0;
|
||||
$allow = $allow && !count(array_intersect($node['deny'], $aros));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -186,7 +196,6 @@ class PhpAcl extends Object implements AclInterface {
|
|||
|
||||
/**
|
||||
* Access Control Object
|
||||
*
|
||||
*/
|
||||
class PhpAco {
|
||||
|
||||
|
|
@ -206,6 +215,11 @@ class PhpAco {
|
|||
'*' => '.*',
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $rules Rules array
|
||||
*/
|
||||
public function __construct(array $rules = array()) {
|
||||
foreach (array('allow', 'deny') as $type) {
|
||||
if (empty($rules[$type])) {
|
||||
|
|
@ -219,6 +233,7 @@ class PhpAco {
|
|||
/**
|
||||
* return path to the requested ACO with allow and deny rules attached on each level
|
||||
*
|
||||
* @param string $aco ACO string
|
||||
* @return array
|
||||
*/
|
||||
public function path($aco) {
|
||||
|
|
@ -236,7 +251,7 @@ class PhpAco {
|
|||
}
|
||||
|
||||
foreach ($root as $node => $elements) {
|
||||
$pattern = '/^' . str_replace(array_keys(self::$modifiers), array_values(self::$modifiers), $node) . '$/';
|
||||
$pattern = '/^' . str_replace(array_keys(static::$modifiers), array_values(static::$modifiers), $node) . '$/';
|
||||
|
||||
if ($node == $aco[$level] || preg_match($pattern, $aco[$level])) {
|
||||
// merge allow/denies with $path of current level
|
||||
|
|
@ -263,6 +278,10 @@ class PhpAco {
|
|||
/**
|
||||
* allow/deny ARO access to ARO
|
||||
*
|
||||
* @param string $aro ARO string
|
||||
* @param string $aco ACO string
|
||||
* @param string $action Action string
|
||||
* @param string $type access type
|
||||
* @return void
|
||||
*/
|
||||
public function access($aro, $aco, $action, $type = 'deny') {
|
||||
|
|
@ -273,7 +292,7 @@ class PhpAco {
|
|||
|
||||
foreach ($aco as $i => $node) {
|
||||
if (!isset($tree[$node])) {
|
||||
$tree[$node] = array(
|
||||
$tree[$node] = array(
|
||||
'children' => array(),
|
||||
);
|
||||
}
|
||||
|
|
@ -303,7 +322,7 @@ class PhpAco {
|
|||
return array_map('strtolower', $aco);
|
||||
}
|
||||
|
||||
// strip multiple occurences of '/'
|
||||
// strip multiple occurrences of '/'
|
||||
$aco = preg_replace('#/+#', '/', $aco);
|
||||
// make case insensitive
|
||||
$aco = ltrim(strtolower($aco), '/');
|
||||
|
|
@ -319,7 +338,6 @@ class PhpAco {
|
|||
*/
|
||||
public function build(array $allow, array $deny = array()) {
|
||||
$this->_tree = array();
|
||||
$tree = array();
|
||||
|
||||
foreach ($allow as $dotPath => $aros) {
|
||||
if (is_string($aros)) {
|
||||
|
|
@ -342,7 +360,6 @@ class PhpAco {
|
|||
|
||||
/**
|
||||
* Access Request Object
|
||||
*
|
||||
*/
|
||||
class PhpAro {
|
||||
|
||||
|
|
@ -385,6 +402,13 @@ class PhpAro {
|
|||
*/
|
||||
protected $_tree = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $aro The aro data
|
||||
* @param array $map The identifier mappings
|
||||
* @param array $aliases The aliases to map.
|
||||
*/
|
||||
public function __construct(array $aro = array(), array $map = array(), array $aliases = array()) {
|
||||
if (!empty($map)) {
|
||||
$this->map = $map;
|
||||
|
|
@ -436,7 +460,7 @@ class PhpAro {
|
|||
$mapped = '';
|
||||
|
||||
if (is_array($aro)) {
|
||||
if (isset($aro['model']) && isset($aro['foreign_key']) && $aro['model'] == $aroGroup) {
|
||||
if (isset($aro['model']) && isset($aro['foreign_key']) && $aro['model'] === $aroGroup) {
|
||||
$mapped = $aroGroup . '/' . $aro['foreign_key'];
|
||||
} elseif (isset($aro[$model][$field])) {
|
||||
$mapped = $aroGroup . '/' . $aro[$model][$field];
|
||||
|
|
@ -453,7 +477,7 @@ class PhpAro {
|
|||
|
||||
$aroModel = Inflector::camelize($aroModel);
|
||||
|
||||
if ($aroModel == $model || $aroModel == $aroGroup) {
|
||||
if ($aroModel === $model || $aroModel === $aroGroup) {
|
||||
$mapped = $aroGroup . '/' . $aroValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -468,7 +492,7 @@ class PhpAro {
|
|||
return $this->aliases[$mapped];
|
||||
}
|
||||
}
|
||||
return self::DEFAULT_ROLE;
|
||||
return static::DEFAULT_ROLE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -519,8 +543,8 @@ class PhpAro {
|
|||
* @param array $alias alias from => to (e.g. Role/13 -> Role/editor)
|
||||
* @return void
|
||||
*/
|
||||
public function addAlias(array $alias) {
|
||||
$this->aliases = array_merge($this->aliases, $alias);
|
||||
public function addAlias(array $alias) {
|
||||
$this->aliases = $alias + $this->aliases;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue