mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Starting to migrate AuthComponent to the new class loader
This commit is contained in:
parent
f8a08432f4
commit
f1e2f5e949
11 changed files with 27 additions and 22 deletions
|
@ -12,7 +12,8 @@
|
|||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
App::import('Component', 'auth/base_authorize');
|
||||
|
||||
App::uses('BaseAuthorize', 'Controller/Component/Auth');
|
||||
|
||||
/**
|
||||
* An authorization adapter for AuthComponent. Provides the ability to authorize using the AclComponent,
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
App::import('Core', 'Security');
|
||||
|
||||
App::uses('Security', 'Utility');
|
||||
|
||||
/**
|
||||
* Base Authentication class with common methods and properties.
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
App::import('Component', 'auth/base_authenticate');
|
||||
|
||||
App::uses('BaseAuthorize', 'Controller/Component/Auth');
|
||||
|
||||
/**
|
||||
* Basic Authentication adapter for AuthComponent.
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
App::import('Component', 'auth/base_authorize');
|
||||
|
||||
App::uses('BaseAuthorize', 'Controller/Component/Auth');
|
||||
|
||||
/**
|
||||
* An authorization adapter for AuthComponent. Provides the ability to authorize using a controller callback.
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
App::import('Component', 'auth/base_authorize');
|
||||
|
||||
App::uses('BaseAuthorize', 'Controller/Component/Auth');
|
||||
|
||||
/**
|
||||
* An authorization adapter for AuthComponent. Provides the ability to authorize using CRUD mappings.
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
App::import('Component', 'auth/base_authenticate');
|
||||
|
||||
App::uses('BaseAuthenticate', 'Controller/Component/Auth');
|
||||
|
||||
/**
|
||||
* Digest Authentication adapter for AuthComponent.
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
App::import('Component', 'auth/base_authenticate');
|
||||
|
||||
App::uses('BaseAuthenticate', 'Controller/Component/Auth');
|
||||
|
||||
/**
|
||||
* An authentication adapter for AuthComponent. Provides the ability to authenticate using POST
|
||||
|
|
|
@ -407,8 +407,10 @@ class AuthComponent extends Component {
|
|||
unset($config[AuthComponent::ALL]);
|
||||
}
|
||||
foreach ($config as $class => $settings) {
|
||||
list($plugin, $class) = pluginSplit($class, true);
|
||||
$className = $class . 'Authorize';
|
||||
if (!class_exists($className) && !App::import('Component', 'auth/' . $class . '_authorize')) {
|
||||
App::uses($className, $plugin . 'Controller/Component/Auth');
|
||||
if (!class_exists($className)) {
|
||||
throw new CakeException(__('Authorization adapter "%s" was not found.', $class));
|
||||
}
|
||||
if (!method_exists($className, 'authorize')) {
|
||||
|
@ -645,8 +647,10 @@ class AuthComponent extends Component {
|
|||
unset($config[AuthComponent::ALL]);
|
||||
}
|
||||
foreach ($config as $class => $settings) {
|
||||
list($plugin, $class) = pluginSplit($class, true);
|
||||
$className = $class . 'Authenticate';
|
||||
if (!class_exists($className) && !App::import('Component', 'auth/' . $class . '_authenticate')) {
|
||||
App::uses($className, $plugin . 'Controller/Component/Auth');
|
||||
if (!class_exists($className)) {
|
||||
throw new CakeException(__('Authentication adapter "%s" was not found.', $class));
|
||||
}
|
||||
if (!method_exists($className, 'authenticate')) {
|
||||
|
|
|
@ -425,7 +425,7 @@ class App {
|
|||
public static function objects($type, $path = null, $cache = true) {
|
||||
$objects = array();
|
||||
$extension = '/\.php$/';
|
||||
$directories = false;
|
||||
$includeDirectories = false;
|
||||
$name = $type;
|
||||
|
||||
if (isset(self::$legacy[$type . 's'])) {
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
* @since CakePHP(tm) v 1.2.0.5435
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
App::uses('AclComponent', 'Component');
|
||||
App::uses('DbAcl', 'Model');
|
||||
|
||||
|
||||
App::uses('AclComponent', 'Controller/Component');
|
||||
App::uses('AclNode', 'Model');
|
||||
class_exists('AclComponent');
|
||||
|
||||
/**
|
||||
* AclNodeTwoTestBase class
|
||||
|
|
|
@ -332,15 +332,11 @@ class AuthTest extends CakeTestCase {
|
|||
|
||||
$this->Controller = new AuthTestController($request);
|
||||
|
||||
<<<<<<< HEAD
|
||||
ClassRegistry::addObject('view', new View($this->Controller));
|
||||
=======
|
||||
$collection = new ComponentCollection();
|
||||
$collection->init($this->Controller);
|
||||
$this->Auth = new TestAuthComponent($collection);
|
||||
$this->Auth->request = $request;
|
||||
$this->Auth->response = $this->getMock('CakeResponse');
|
||||
>>>>>>> origin/2.0
|
||||
|
||||
$this->Controller->Components->init($this->Controller);
|
||||
|
||||
|
@ -935,7 +931,6 @@ class AuthTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* testPluginModel method
|
||||
*
|
||||
* @access public
|
||||
|
@ -946,7 +941,7 @@ class AuthTest extends CakeTestCase {
|
|||
Cache::delete('object_map', '_cake_core_');
|
||||
App::build(array(
|
||||
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
|
||||
'models' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'models' . DS)
|
||||
'Model' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'models' . DS)
|
||||
), true);
|
||||
App::objects('plugin', null, false);
|
||||
|
||||
|
@ -996,8 +991,6 @@ class AuthTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
=======
|
||||
>>>>>>> origin/2.0
|
||||
* testAjaxLogin method
|
||||
*
|
||||
* @access public
|
||||
|
@ -1005,7 +998,7 @@ class AuthTest extends CakeTestCase {
|
|||
*/
|
||||
function testAjaxLogin() {
|
||||
App::build(array(
|
||||
'views' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
||||
'View' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
||||
));
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = "XMLHttpRequest";
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue