pictcode / lib / Cake / Controller / Component / Auth / ActionsAuthorize.php @ 0b1b8047
履歴 | 表示 | アノテート | ダウンロード (1.387 KB)
1 |
<?php
|
---|---|
2 |
/**
|
3 |
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
4 |
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
5 |
*
|
6 |
* Licensed under The MIT License
|
7 |
* For full copyright and license information, please see the LICENSE.txt
|
8 |
* Redistributions of files must retain the above copyright notice.
|
9 |
*
|
10 |
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
11 |
* @link http://cakephp.org CakePHP(tm) Project
|
12 |
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
13 |
*/
|
14 |
|
15 |
App::uses('BaseAuthorize', 'Controller/Component/Auth'); |
16 |
|
17 |
/**
|
18 |
* An authorization adapter for AuthComponent. Provides the ability to authorize using the AclComponent,
|
19 |
* If AclComponent is not already loaded it will be loaded using the Controller's ComponentCollection.
|
20 |
*
|
21 |
* @package Cake.Controller.Component.Auth
|
22 |
* @since 2.0
|
23 |
* @see AuthComponent::$authenticate
|
24 |
* @see AclComponent::check()
|
25 |
*/
|
26 |
class ActionsAuthorize extends BaseAuthorize { |
27 |
|
28 |
/**
|
29 |
* Authorize a user using the AclComponent.
|
30 |
*
|
31 |
* @param array $user The user to authorize
|
32 |
* @param CakeRequest $request The request needing authorization.
|
33 |
* @return bool
|
34 |
*/
|
35 |
public function authorize($user, CakeRequest $request) { |
36 |
$Acl = $this->_Collection->load('Acl'); |
37 |
$user = array($this->settings['userModel'] => $user); |
38 |
return $Acl->check($user, $this->action($request)); |
39 |
} |
40 |
|
41 |
} |