Merge branch '138-toggle-free-look-with-hotkey' into 'main/atys-live'
[ryzomcore.git] / web / public_php / webtt / app / controllers / app_controller.php
blob03bfdf4cb1fafa32bdda0c89e6cdf94486319dca
1 <?php
2 /**
3 * Application level Controller
5 * This file is application-wide controller file. You can put all
6 * application-wide controller-related methods here.
8 * PHP versions 4 and 5
10 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
11 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
13 * Licensed under The MIT License
14 * Redistributions of files must retain the above copyright notice.
16 * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
17 * @link http://cakephp.org CakePHP(tm) Project
18 * @package cake
19 * @subpackage cake.cake.libs.controller
20 * @since CakePHP(tm) v 0.2.9
21 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
24 /**
25 * This is a placeholder class.
26 * Create the same file in app/app_controller.php
28 * Add your application-wide methods in the class below, your controllers
29 * will inherit them.
31 * @package cake
32 * @subpackage cake.cake.libs.controller
33 * @link http://book.cakephp.org/view/957/The-App-Controller
35 class AppController extends Controller {
36 var $components = array('DebugKit.Toolbar' => array(
37 // 'panels' => array('variables'=>false)
38 ), 'Session', 'PathResolver', 'Auth');
39 var $layout = "new";
41 function beforeFilter() {
42 parent::beforeFilter();
43 $this->Auth->autoRedirect = false;
44 $this->Auth->authorize = 'controller';
45 $this->Auth->userScope = array('User.activated' => true, 'User.confirm_hash' => null);
46 $this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
48 if ($this->Auth->user('role') == "admin")
49 $this->Auth->allow("*");
50 else if ($this->Auth->user())
52 // $this->Auth->allow('index', 'view', 'add', 'delete', 'edit');
53 foreach ($this->methods as $method)
54 if (mb_strpos($method, 'admin_') !== 0)
55 $this->Auth->allow($method);
59 function isAuthorized() {
60 /* if (isset($this->params['prefix']) && $this->params['prefix'] == "admin" && $this->Auth->user('role') != "admin")
62 return false;
65 return true;*/
66 $action = $this->params['action'];
67 $allowedActions = array_map('strtolower', $this->Auth->allowedActions);
68 $isAllowed = (
69 $this->Auth->allowedActions == array('*') ||
70 in_array($action, $allowedActions)
72 // $this->log($isAllowed);
73 return $isAllowed;