- Download the latest release from Yii extensions Auth.
and placed under folder protected/modules, if not please create one folder named modules
2)Then protected/config/main.php
on module array add
'modules'=>array(
.........
'auth',
),
OR
'modules'=>array(
.........
'auth' => array(
'strictMode' => true, // when enabled authorization items cannot be assigned children of the same type.
'userClass' => 'User', // the name of the user model class.
'userIdColumn' => 'id', // the name of the user id column.
'userNameColumn' => 'name', // the name of the user name column.
'appLayout' => 'application.views.layouts.main', // the layout used by the module.
'viewDir' => null, // the path to view files to use with this module.
),
),
in components array
'components' => array(
'authManager' => array(
......
'behaviors' => array(
'auth' => array(
'class' => 'auth.components.AuthBehavior',
'admins' => array('admin', 'foo', 'bar'), // users with full access
),
),
),
'user' => array(
'class' => 'auth.components.AuthWebUser',
),
),
Please note that while the module doesn’t require you to use a database, if you wish to use CDbAuthManager you need it’s schema (it can be found in the framework under web/auth/schema-mysql.sql(if mysql is using), and it import to your db).
also change the authManager array to
'authManager' => array(
'class' => 'CDbAuthManager',
'connectionID' => 'db',
'behaviors' => array(
'auth.components.AuthBehavior',
),
),
and in main controller please use
public function filters()
{
return array(
array('auth.filters.AuthFilter'),
);
}
auth module will ready to use index.php?r=auth with normal template
-
if you want to use bootstrap pleas do as below
download bootstrap from http://www.yiiframew…nsion/bootstrap and placed under protected/extension/bootstrap
then copy the theme from bootstrap to theme folder under you webapplication/themes/
Top of the protected/config/main.php add
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
in components array
'bootstrap'=>array(
'class'=>'bootstrap.components.Bootstrap',
),
and change appLayout from auth array as below
modules =array(
auth=>array(
......
'appLayout' => 'webroot.themes.theme.views.layouts.main', // the layout used by the module.
)
),