Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7762467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:24:41+00:00 2026-06-01T14:24:41+00:00

I am using acl and I want to redirect the users based on which

  • 0

I am using acl and I want to redirect the users based on which group they are from

in my appcaontroller I have this

public function beforeFilter() {
                                //Configure AuthComponent
                                //$this->Auth->allow('display');
                                $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
                                $this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
                                $this->Auth->loginRedirect = array('controller' => 'posts', 'action' => 'add');
    }

what should I do so if the user is from group_id 1, he/she should be redirected to a place different than group_id = 4 etc

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:24:43+00:00Added an answer on June 1, 2026 at 2:24 pm

    Okay so for example you are redirecting every user to an action say dashboard. Instead of redirecting the user to add action of posts controller redirect to dashboard of users controller. I am assuming you have another table for groups and you are keeping it’s foreign key in users table.

        $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'dashboard');
    

    The above will redirect user upon login to dashboard action in users controller. Now to take every user to a specific group, get the group name of user and redirect to specific page.

      function dashboard() {
          //get user's group (role)
        $group_name = $this->User->Group->field('name', array('id' => $this->Auth->User('group_id')));
        //group selection logic here
        $action = 'dashboard_' . $group_name;
        $this->redirect('controller' => 'users' => 'action' => $action);
      }
    

    So the above code will take every user to specific action e.g. if group name is ‘managers’ user will be redirected to ‘managers_dashboard’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have group based restrictions that would allow users to access
i just want to know the difference between using ACL and spring role-based authorization
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
I can't figure this out. Here's what I want to happen ... I have
In CakePHP, when you are using Acl/Auth, do you need to have Routing.prefixes enabled
I want to use the navigation helper to build my navigation menus using Acl.
I have the following two actions in my controller: function add() { if (!empty($this->data))
I'm using spark_plug plugin on cakephp, this plugin provides an authentication-acl system for register
Using Nunit, I want to be able to write a test fixture that will
Using Flex 3, I would like to take an image snapshot such as this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.