Finally, we must secure the backend application with an authentication mechanism. We will accomplish this by installing the sfGuardPlugin
plugin to provide us with the improved auth process and login actions, and then setting the security settings of the application.
Just like any other PHP application, security settings are generally stored in the session. Symfony transparently handles this within the sfUser
class along with any other session data.
Setting and retrieving attributes in the session is similar to accessing any other parameter holder.
$this->getUser()->setAttribute('attribute'); $this->getUser()->getAttribute('attribute', 'default_value'); $this->getUser()->hasAttribute('attribute');
Of course, accessing session attributes from the template is similar to this:
$sf_user->getAttribute('attribute');
By default, sessions are stored in files on the server. But just by modifying the apps/backend/config/factories.yml
file, you can configure...