This chapter confuses many people and I was one this person. Read some hints (here in this subforum) and make several tests, I finaly made it works.
I’ll try explain it with code blocks. Keep in mind that I made these tests using Ubuntu 10.04.
Step #1 – Pg 179 - Configuring the authorization manager
Here we need to configure our protected/config/main.php, however I thought this part is confuse. Where I put the code suggested? I will show where we must put it.
Open the file trackstar/protected/config/main.php. (I’ll show a piece of code)
<?php
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
Begin of File
// application components
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
// uncomment the following to enable URLs in path-format
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName' => false,
'urlSuffix' => '.html',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
// uncomment the following to use a MySQL database
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=trackstar_dev',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'xxxxxxx',
'charset' => 'utf8',
),
//Here we must put the code suggested.
//This code is under components array()
'authManager'=>array(
'class'=>'CDbAuthManager',
'connectionID'=>'db',
),
…
),
…
End of file
);
?>