Hello,
I am newer with Yii and today I have installed the auth extension but when I want to access to /auth/assignment/index, /auth/role/index, …, the application show me "Error 401 Access denied".
The problem is that "if ($user->isAdmin)" always return false. If I comment the above line and the extension works fine.
I have a rol "admin" in AuthItem and a user with this role in AuthAssignment.
'import'=>array(
'application.models.*',
'application.components.*',
'application.modules.auth.*',
'application.modules.auth.components.*',
),
'theme'=>'bootstrap', // requires you to copy the theme under your themes directory
'modules'=>array(
// uncomment the following to enable the Gii tool
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'xxxx',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
'generatorPaths'=>array(
'bootstrap.gii',
),
),
'auth' => array(
'strictMode' => true, // when enabled authorization items cannot be assigned children of the same type.
'userClass' => 'Usuario', // the name of the user model class.
'userIdColumn' => 'id', // the name of the user id column.
'userNameColumn' => 'email', // the name of the user name column.
'defaultLayout' => 'application.views.layouts.main', // the layout used by the module.
'viewDir' => null, // the path to view files to use with this module.
),
),
// application components
'components'=>array(
'bootstrap'=>array(
'class'=>'bootstrap.components.Bootstrap',
),
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
'class' => 'auth.components.AuthWebUser',
),
// para gestionar la autenticación basada en roles con base de datos (db definido después en este mismo fichero)
'authManager'=>array(
'class'=>'CDbAuthManager',
// 'class'=>'auth.components.CachedDbAuthManager',
// 'cachingDuration'=>3600,
'connectionID'=>'db',
'behaviors' => array(
'auth' => array(
'class' => 'auth.components.AuthBehavior',
'admins' => array('admin'), // users with full access
),
),
),
Thanks.