Take a look at this tutorial and read part III:
http://www.ibm.com/developerworks/opensource/tutorials/os-php-cake2/index.html

On 8 Feb., 17:31, Renato de Freitas Freire <[email protected]> wrote:
> Hi!
>
> Im trying to understand this ACL tutorial by Cakebook, but its absolutely
> incomplete.
> Can anyone tell me where I can find a good acl tutorial? Good and
> understandable.
>
> I need to build a login system based on groups and users permissions, but I
> need to know how to handle owners information.
> Like blog tutorial, only the owner or admin can edit a post, or change user
> information, etc.
> Others users can only see the post.
> How to change password, automaticaly add users and permissions, password
> recovery, control access (dont let users access adm area nor other users
> area), etc.
>
> Please, can anyone help me? Im a little lost here.
>
> Tnx!
>
> --
> Renato de Freitas Freire
> [email protected]
>
> On Sun, Feb 7, 2010 at 10:45 PM, [email protected] 
> <[email protected]>wrote:
>
> > When isAuthorized() returns false I get redirected to "/"  which then
> > redirects to "pages controller"...
>
> > Here is my code:
>
> > App_controller:
>
> > class AppController extends Controller {
>
> >   var $components = array('Auth', 'Session');
>
> >   var $helpers = array('Javascript', 'Html', 'Form', 'Ajax',
> > 'Session');
>
> >   function beforeFilter() {
>
> >      $this->Auth->authorize = 'controller';
>
> >      $this->Auth->userModel = 'Member';
>
> >      Security::setHash("md5");
>
> >      $this->Auth->fields = array('username' => 'email', 'password' =>
> > 'password');
>
> >      $this->Auth->loginAction = array('controller' => 'members',
> > 'action' => 'add');
>
> >      $this->Auth->loginRedirect = array('controller' => 'members',
> > 'action' => 'myaccount');
>
> >      $this->Auth->logoutRedirect = array('controller' => 'members',
> > 'action' => 'login');
>
> >      $this->Auth->autoRedirect = false;
>
> >   }
>
> > }
>
> > and here is my members controller:
>
> > function isAuthorized(){
> >                switch ($this->action) {
> >                        case "index":
> >                                return ($this->Auth->user('rol') ==
> > 'admin');
> >                        break;
> >                        default:
> >                                return true;
> >                }
> >        }
> >        /* function that handles the login*/
> >        function login(){
> >                if($this->Auth->login()){
> >                        if($this->Auth->user('rol') == 'member'){ #check if
> > it is a member
> > or an admin
> >                                $this->redirect('myaccount');
> >                        }elseif ($this->Auth->user('rol' == 'admin')) {
> >                                $this->redirect('index');
> >                        }
>
> >                }
> >        }
>
> > I have tried changing all properties of Auth in app_controller with no
> > results, it always redirects to "/"
> >  I just want to redirect to the login page or maybe just show a
> > message.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<cake-php%[email protected]>For
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to