Wednesday, September 28, 2011

[Noob!] Acl Tutorial Question

I just finished the blog tutorial, and moved on to the Acl tutorial
using the blog --

I walked through the whole ordeal but still seems that when I log in
as user with permission 1 (admin) I still receive the Auth message of:
"You are not authorized to access that location."

// app_controller.php
<?php

class AppController extends Controller {
var $components = array('Acl', 'Auth', 'Session');
var $helpers = array('Html', 'Form', 'Session');
function beforeFilter() {
// configure authcomponent
$this->Auth->loginAction = array('controller' => 'users', 'action'
=> 'login');
$this->Auth->logoutRedirect = array('controller' => 'users',
'action' => 'logout');
$this->Auth->loginRedirect = array('controller' => 'posts', 'action'
=> 'add');
$this->Auth->actionPath = 'controllers/';
$this->Auth->allow('display');
$this->Auth->authorize = 'controller';
$this->Auth->userScope = array('User.active = 1');
$this->set('Auth',$this->Auth->user());
}
function beforeRender(){
$this->set('currentUser', $this->Auth->user());
}
function afterFilter() {
# Update User last_access datetime
if ($this->Auth->user()) {
$this->loadModel('User');
$this->User->id = $this->Auth->user('id');
$this->User->saveField('last_access', date('Y-m-d
H:i:s'));
}
}
}
?>

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: