Question Acl

2 messages Options
Embed this post
Permalink
cakos

Question Acl

Reply Threaded More More options
Print post
Permalink
Hello

I'm a noob  in cakePhp (and english ... ) I hope you'll exuse me if my questions are absurd
I have two question about the Acl access.
If I understand (tell me if I'm wrong) if I use Acl, my programm will do this :

Code:

class UsersController extends AppController {

    var $name = 'Users';
    var $helpers = array('Html', 'Form');

    function beforeFilter() {        
               $this->Auth->actionPath = 'controllers/';

            if(isset($this->Auth))
                {
                   
                  $this->Auth->userModel = 'User';
                  $this->Auth->userScope = array('User.disabled' => 0);                    
                  $this->Auth->fields = array('username' => 'login', 'password' => 'password');            
                  $this->Auth->loginAction = '/users/login';
                  $this->Auth->loginRedirect = '/articles/index';
                  $this->Auth->logoutRedirect = '/';
                  $this->Auth->loginError = "Identifiant ou mot de passe incorrects.";
                  $this->Auth->authError = "Vous n'avez pas accès à cette page.";                
                  $this->Auth->autoRedirect = true;
                  $this->Auth->authorize = 'actions';            
              }
    }
   

    function admin_index() {
                $users= $this->User->find('all');      
        $this->set('users', $users);
    }

      function login(){
            $this->layout = 'admin_default';
      }
}

Imagine, a user want to execute admin_index()
 - 'beforeFilter()' is execute
 -  Acl execute  a  login page (how Acl know which one ?)
 -  the user is identify
 -  the user execute  admin_index()

If my implentation is good (the result seems ok) how in 'admin_index()' , i can  acces to the user's informations (login, name or better his Id) ?
If a user is already connected, the system don't ask him to login if he wantes to execute 'admin_index()', so the informations is somewhere
 
My first question is, how this information is stock ? Only the information about the user is connected ? or  the information about the user connected ?
My second question is how to acces to these data ?

I hope somebody will take pity on me ;)
thank you
a+
davidgolding

Re: Question Acl

Reply Threaded More More options
Print post
Permalink
I do take pity on you :) ACL is a challenging thing, in or out of Cake. I recommend checking out the new book, "Practical CakePHP Projects" by Kai Chan and John Omokore. They've got a good chapter in there about ACL implementation in Cake.

I'll try to revisit your question once I have some time to tackle ACL in RC3.
--Dave

Author, "Beginning CakePHP: From Novice to Professional"

[ get your copy at: http://www.amazon.com/Beginning-CakePHP-Novice-Professional/dp/1430209771/ ]