0

I would like to ask something about CakePHP and CakeDC user plugin... Yesterday I started my first CakePHP application (blog from CakePHP tutorial without login users). It's great, everything works Ok. Today I installed the plugin CakeDC users. I can log in, log out, change password, dashboard is available only for logged users etc. It is all ok. But... How can I protect others actions with this plugin? For example - action dashboard (prom cakeDC plugin) is accessible only to logged users. action add (add post to blog from CakePHP tutorial) is accesible to all users.

So my question is: How can I protect this action (add post) for logged users?

I'm trying it all day, but without success Thanks..

telman
  • 1

1 Answers1

2

your questions is related to the AuthComponent. You'll need to configure PostsController to use AuthComponent and define which actions are public or restricted only to logged in users.

This is the related page in the book : http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html

You could add the AuthComponent configuration to the AppController class, in case you want to protect ALL your controllers by default, or to the PostsController, Example:

public $components = array(
    'Auth'
);

You may want to customize AuthComponent settings via settings array or leave it as it is to use defaults (CakeDC UsersPlugin will work using defaults)

steinkel
  • 1,156
  • 9
  • 15