0
votes

I passed through few basic tutorials of CakePHP. Now I'm trying to understand Authentication Component.

Why in this tutorial: http://book.cakephp.org/pl/view/643/Preparing-to-Add-Auth they create new class AppController? I ask because I've just created some controllers where classes inherited from AppController class and I haven't had the own AppController class yet.

2

2 Answers

1
votes

You create a new AppController to define new extended functionality for your controllers.

Basically all your controllers should extend your new AppController class, which defines all your authentication logic. These beforeFilter()/afterFilter() methods are run automatically by your dispatcher and these methods can dictate whether or not to continue processing the current controller.

0
votes

Next we need to make some modifications to AppController. If you don't have /app/app_controller.php, create it. Note that this goes in /app/, not /app/controllers/. Since we want our entire site controlled with Auth and Acl, we will set them up in AppController.

In this example, you are simply making modifications (adding a beforeFilter() callback) to the "skeleton" AppController class. This class will be extended by all of the controllers in your app. It's a way to add functionality that applies to all controllers in your app.