2011-01-02 19:24:25 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2017-06-10 21:33:55 +00:00
|
|
|
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
2017-06-10 22:10:52 +00:00
|
|
|
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
2011-01-02 19:24:25 +00:00
|
|
|
*
|
|
|
|
* Licensed under The MIT License
|
2013-02-08 12:22:51 +00:00
|
|
|
* For full copyright and license information, please see the LICENSE.txt
|
2011-01-02 19:24:25 +00:00
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
2017-06-10 22:10:52 +00:00
|
|
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
2017-06-10 21:33:55 +00:00
|
|
|
* @link https://cakephp.org CakePHP(tm) Project
|
2017-06-10 22:23:14 +00:00
|
|
|
* @license https://opensource.org/licenses/mit-license.php MIT License
|
2011-01-02 19:24:25 +00:00
|
|
|
*/
|
2011-08-16 03:55:08 +00:00
|
|
|
|
2011-03-05 22:10:42 +00:00
|
|
|
App::uses('BaseAuthorize', 'Controller/Component/Auth');
|
2011-01-02 19:24:25 +00:00
|
|
|
|
|
|
|
/**
|
2012-12-22 22:48:15 +00:00
|
|
|
* An authorization adapter for AuthComponent. Provides the ability to authorize using the AclComponent,
|
2011-01-02 19:24:25 +00:00
|
|
|
* If AclComponent is not already loaded it will be loaded using the Controller's ComponentCollection.
|
|
|
|
*
|
2011-07-26 06:16:14 +00:00
|
|
|
* @package Cake.Controller.Component.Auth
|
2011-01-02 19:24:25 +00: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.
|
2014-07-03 13:36:42 +00:00
|
|
|
* @return bool
|
2011-01-02 19:24:25 +00:00
|
|
|
*/
|
|
|
|
public function authorize($user, CakeRequest $request) {
|
2011-02-18 04:17:07 +00:00
|
|
|
$Acl = $this->_Collection->load('Acl');
|
2011-06-03 01:53:56 +00:00
|
|
|
$user = array($this->settings['userModel'] => $user);
|
2011-01-02 19:24:25 +00:00
|
|
|
return $Acl->check($user, $this->action($request));
|
|
|
|
}
|
2012-03-04 00:27:46 +00:00
|
|
|
|
2011-06-03 01:53:56 +00:00
|
|
|
}
|