Hi
very helpful
Thanks
On Friday, March 1, 2013 9:52:29 PM UTC+2, di wrote:
>
> I have this:
> In routes.php: Router::connect(‘/admin’, array(‘controller’ => ‘users’,
> ‘action’ => ‘index’,'add’, ‘admin’ => true,’prefix’ => ‘admin’,'layout’ =>
> ‘admin’));
>
> In core.php: (debug, 0)
>
> In appController:
> class AppController extends Controller {
> public $components = array(
> ‘Session’,
> ‘Auth’=>array(
> ‘loginRedirect’=>array(‘controller’=>’pagina_inicial’,
> ‘action’=>’index’,'admin’=>false),
> ‘logoutRedirect’=>array(‘controller’=>’users’, ‘action’=>’login’),
> ‘authError’=>" ”,
> ‘authorize’=>array(‘Controller’)
> )
> );
>
> public $helpers = array(‘Session’,'form’,'Html’,'PhpExcel’);
> public $pdfConfig = array(
> ‘engine’ => ‘CakePdf.Tcpdf’,
> );
>
> public $cacheAction = ’1 hour’;
>
> public function isAuthorized($user) {
> $role=$this->Session->read(‘Auth.User.role’);
>
> //die(debug($role));
> if(isset($this->request->prefix) && $role!=’admin’){
> return FALSE;
> }
> return true;
> }
>
> public function beforeFilter() {
> $this->Auth->allow(‘*’);
> //$this->set(‘logged_in’, $this->Auth->loggedIn());
> //$this->set(‘current_user’, $this->Auth->user());
>
> // if its the administrator/manager – change the layout
> /**if (isset($this->params['prefix']) && $this->params['prefix'] ==
> ‘admin’) {
> $this->layout = ‘admin’;
> } else {
> $this->layout = ‘user’;
> }**/
>
> }
> public function beforeRender() {
> $this->_configureErrorLayout();
> }
>
> public function _configureErrorLayout() {
> if ($this->name == ‘CakeError’) {
> if ($this->_isAdminMode()) {
> $this->layout = ‘admin’;
> } else {
> $this->layout = ‘default’;
> }
> }
> }
>
> public function _isAdminMode() {
> $adminRoute = Configure::read(‘Routing.prefixes’);
> if (isset($this->params['prefix']) && in_array($this->params['prefix'],
> $adminRoute)) {
> return true;
> }
> return false;
> }
>
> also have:
>
> app/view/layout/default.ctp and app/view/layout/admin.ctp
> app/view/Homepage/index.ctp and app/view/HomePage/admin_index.ctp
>
> But not working, what am I doing wrong, any help please.
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.