I do a similar thing but I an using the Auth component without ACL.
However, I have added a 'role' field to my users table so I can select
actions based on the user's role like you desire.

In my controller I have the following:

class PagesController extends AppController {

        public $name = 'Pages';
        .
        .
        .
        public $components = array('Auth');

        public function beforeFilter() {
                // Allow all pages to be accessed by all users by default
                $this->Auth->allow('*');
                // If the client or admin is not logged in, deny access to edit
functions
                $role = $this->Auth->user('role');
                if ($role == 'client' || $role == 'admin') {
                        $this->set('role', $role);
                }
                else {
                        $this->Auth->deny('edit', 'add', 'delete');
                }
        }
}

In the view I have:

if (!empty($role) && ($role == 'client' || $role == 'admin')) {
  echo $html->link('Action 1',
    array('controller'=>'pages', 'action'=>'action_1'))."\n";
}

if (!empty($role) && ($role == 'admin')) {
  echo $html->link('Action 2',
    array('controller'=>'pages', 'action'=>'action_2'))."\n";
}

echo $html->link('Action 3',
    array('controller'=>'pages', 'action'=>'action_3'))."\n";

So
User      Links Displayed
admin    action_1, action_2, action_3
client     action_1, action_3
all          action_3

I hope this helps
Ken

On Dec 24, 11:03 pm, kani <[email protected]> wrote:
> How to hide/show links in view /default.ctp/ for different types of
> user group./admin manager user/
> I used acl component.

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