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

  • SEARCH
  • Home
  • 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 6591529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:26:06+00:00 2026-05-25T17:26:06+00:00

Sept 2 update: This has become a very difficult puzzle to solve. Setting up

  • 0

Sept 2 update:

This has become a very difficult puzzle to solve. Setting up a basic auth, which is all that I want, should involve very few steps. I have done many tests, adding and removing code, reviewing the cake manual, reading tutorials and going step by step through the cakePHP 1.3 application development cookbook by Mariano Iglesias – good book. http://goo.gl/93BGw

But the problem I’m still facing is that the app controller is the only place the ‘allowed’ actions work. In individual controllers the parent:beforeFilter doesn’t get recognized and I’m redirected back to the users login page.

Any help with this is really appreciated. What I’m wondering is how I might debug this type of problem. Are there any other configuration settings I should look at, like ‘prefix routing’?

=======================

Sept 1 update:

After a lot of testing what appears to be the issue is that the ‘before:filter’ in individual controllers isn’t being recognized. Example in the post controller:

    public function beforeFilter() {
    parent::beforeFilter();
    $this->Auth->allow = array('edit'); 
}

Has anyone had this happen before? I’ve referred to the cakePHP manual as well as many online articles and tutorials and it doesn’t make any sense to me. I’ve even tried to build a simple application with just the users and post controller and still, the before:filter settings in each controller aren’t being recognized.

=======================
Original question.

I am using the Cakephp auth component to manage an admin section. This is using version 1.3.11

The problem I’m having is that even with allowed actions in each controller, I’m being redirected to the user login page.

Here is what’s in the app controller:

class AppController extends Controller {

var $components  = array(
'Auth' => array(
'authorize' => 'controller'
),
'Session',
'RequestHandler'
);

public function isAuthorized() { 
return true; 
}

function beforeFilter(){
    $this->Auth->authorize = 'controller';
    $this->Auth->fields = array('username' => 'username', 'password' => 'password');
    $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
    $this->Auth->authError = 'Please login to view that page ';
    $this->Auth->loginError =' The user name or password you entered did not work, please try again ' ; 
            $this->Auth->allow('display');
    $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login'); 
    $this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'logout'); 
    $this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display', 'home');     
}

This is what’s in the users controller:
class UsersController extends AppController {

var $name = 'Users';

function beforeFilter() {
    parent::beforeFilter();
    $this->Auth->allow = array('add');  
}

This is what’s in the posts controller:

class PostsController extends AppController {

var $name = 'Posts';
var $components = array('Session','RequestHandler', 'Email');   

public function beforeFilter() {
    parent::beforeFilter();
    $this->Auth->allow = array('edit'); 
}

What I do find is that after I’ve logged in I’m able to access the home page, as expected. Then when I go to the logout the session isn’t entirely destroyed so I can go back to the ‘admin’ section.

I did try using $this-session(‘destroy’); in the logout action, but when I did the allowed actions didn’t work again.

Does this make sense? Shouldn’t allowed actions be independent of a current session?

Thanks, Paul

  • 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-05-25T17:26:06+00:00Added an answer on May 25, 2026 at 5:26 pm

    Make sure you are not using requestAction in any of your elements or views, make sure that the actions called by requestAction are allowed too…. this should fix it.

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

Sidebar

Related Questions

Update (21st Sept 2016) - Thanks to Digbyswift for commenting that this solution still
UPDATE Feb 10 2012: zOompf has completed some very thorough research on this very
I'm sure this question has been asked a thousand times but after an hour
Update mysql with $_POST data from while loop I'm trying to get this round
I have an MDX query which lists a measure for all 'Week' and 'Day'
I have HTML that looks like this: <div class=item-list> <h3>Monday Sep 21</h3> <h3>Tuesday Sep
Update Sept. 12, 2011 I was able to get the core file and immediately
I have a string 14-Sep-2011 In need to convert this 14th Sept. This date
when i deploy my war into TomCat i have this error: 14 sept. 2010
I have trouble doing this. I'm creating a method that add working days on

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.