2011-01-02 14:24:25 -05:00
|
|
|
<?php
|
|
|
|
/**
|
2013-11-13 22:58:34 +01:00
|
|
|
*
|
2011-01-02 14:24:25 -05:00
|
|
|
*
|
|
|
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
2013-02-08 20:59:49 +09:00
|
|
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2011-01-02 14:24:25 -05:00
|
|
|
*
|
|
|
|
* Licensed under The MIT License
|
2013-02-08 21:22:51 +09:00
|
|
|
* For full copyright and license information, please see the LICENSE.txt
|
2011-01-02 14:24:25 -05:00
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
2013-02-08 20:59:49 +09:00
|
|
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2011-01-02 14:24:25 -05:00
|
|
|
* @link http://cakephp.org CakePHP(tm) Project
|
2013-05-31 00:11:14 +02:00
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
2011-01-02 14:24:25 -05:00
|
|
|
*/
|
2011-08-15 23:55:08 -04:00
|
|
|
|
2011-03-05 17:40:42 -04:30
|
|
|
App::uses('BaseAuthorize', 'Controller/Component/Auth');
|
2011-01-02 14:24:25 -05:00
|
|
|
|
|
|
|
/**
|
2012-12-22 23:48:15 +01:00
|
|
|
* An authorization adapter for AuthComponent. Provides the ability to authorize using the AclComponent,
|
2011-01-02 14:24:25 -05:00
|
|
|
* If AclComponent is not already loaded it will be loaded using the Controller's ComponentCollection.
|
|
|
|
*
|
2011-07-26 01:46:14 -04:30
|
|
|
* @package Cake.Controller.Component.Auth
|
2011-01-02 14:24:25 -05:00
|
|
|
* @since 2.0
|
|
|
|
* @see AuthComponent::$authenticate
|
|
|
|
* @see AclComponent::check()
|
|
|
|
*/
|
|
|
|
class ActionsAuthorize extends BaseAuthorize {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Authorize a user using the AclComponent.
|
|
|
|
*
|
|
|
|
* @param array $user The user to authorize
|
|
|
|
* @param CakeRequest $request The request needing authorization.
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function authorize($user, CakeRequest $request) {
|
2011-02-17 23:17:07 -05:00
|
|
|
$Acl = $this->_Collection->load('Acl');
|
2011-06-02 21:53:56 -04:00
|
|
|
$user = array($this->settings['userModel'] => $user);
|
2011-01-02 14:24:25 -05:00
|
|
|
return $Acl->check($user, $this->action($request));
|
|
|
|
}
|
2012-03-03 19:27:46 -05:00
|
|
|
|
2011-06-02 21:53:56 -04:00
|
|
|
}
|