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 730427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:54:38+00:00 2026-05-14T06:54:38+00:00

In many tutorial of Acl component in cakephp i got instruction that add component

  • 0

In many tutorial of Acl component in cakephp
i got instruction that add component either in AppController or in all the other controllers which inherits AppController…….

but problem is

var $components=array('Auth',Acl);

when i use the above line in AppConroller i cant use the Auth or Acl component…
but when i use the same code in all the child classes it works fine……..

what will be the problem

here is my appController

<?php
class AppController extends Controller {

     var $helpers = array('Html', 'Form', 'Session','CssMenu');
     var $components = array('Auth');

     function beforeFilter() {
        //Configure AuthComponent
        $this->Auth->authorize = 'actions';
        $this->Auth->authError = "Sorry, you are lacking access.";
        $this->Auth->userModel = 'Login';
}

}
?>

code for usersController

<?php
class userssController extends AppController{
    var $name="Logins";
    //var $components = array('Auth');
    var $layout='login';

    function beforeFilter() {
        parent::beforeFilter();
        $this->Auth->allow('*');
        $this->Auth->loginRedirect = array('controller' => 'homes', 'action' => 'index');
    }
}
?>

when i comment the line 4 this will b error
on uncomment it works fine
thanks in advance

any help will be appreciated.

  • 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-14T06:54:38+00:00Added an answer on May 14, 2026 at 6:54 am

    I think there may be something wrong in your code.If you add the line in /app/cake/libs/controller/app_controller.php,every child class should be able to use the components.See about app_controller in cookbook:

    CakePHP merges the following variables from the AppController to your application’s controllers:$components,$helpers,$uses

    EDit @deceze

    you may write your own customized base controller in /app/yourown_app_controller.php

    class YourOwnAppController extends Controller
    {
           var $components = array("Auth");
    }
    

    then use it by a requirment like require_once(APP."yourown_app_controller.php"); in the child contrller file.

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

Sidebar

Related Questions

I found that many books and tutorial now is teaching how to write GUI
I'm following this tutorial which is working splendidly for has_many :through relationships. I've got
I have followed many a tutorial to make sure that this is correct but
With so many languages and frameworks that exist, and with new ones appearing all
I'd like to achieve this result there are many tutorial around like this but
There are too many tutorials out there on monads that say... Look! here is
It seems that the following is a common method given in many tutorials on
The Zend Tutorial lists many assertions to check the output generated by a request.
In this tutorial (and many others), there's an integer in the CustomXMLParts object collection
In Hibernate tutorial, chapter 25 best practices says we should use 2 one-to-many relationship

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.