Hi partners
Step 1
'db'=>array(
  'connectionString' => 'mysql:host=localhost;dbname=portal',
  'emulatePrepare' => true,
  'username' => 'root',
  'password' => '',
),
                
'authManager'=>array(
  'class'=>'CDbAuthManager',
  'connectionID'=>'db',
),
Step 2
create table AuthItem
(
   name                 varchar(64) not null,
   type                 integer not null,
   description          text,
   bizrule              text,
   data                 text,
   primary key (name)
);
create table AuthItemChild
(
   parent               varchar(64) not null,
   child                varchar(64) not null,
   primary key (parent,child),
   foreign key (parent) references AuthItem (name) on delete cascade on update cascade,
   foreign key (child) references AuthItem (name) on delete cascade on update cascade
);
create table AuthAssignment
(
   itemname             varchar(64) not null,
   userid               varchar(64) not null,
   bizrule              text,
   data                 text,
   primary key (itemname,userid),
   foreign key (itemname) references AuthItem (name) on delete cascade on update cascade
);
Step 3
We have a user with Id=3
Table authitem:
name=admin
type=2 --------------> Rol
description=null
bizrule=null
data=null
-----------------
name=adminUser
type=0 --------------> Operation
descripction=null
bizrule=null
data=null
Table authassignment:
itemname=admin
userid=3
bizrule=null
data=null
Table authitemchild:
parent=admin
child=adminUser
Step 4
public function actionView($id)
{
  if (Yii::app()->user->checkAccess('admin')) {
    $this->render('view',array(
    'model'=>$this->loadModel($id),
    ));
  } else {
    $this->render('view2');
  }
}
If the user ID=3 accesses, should show "view". True??
It is not so, always, ALWAYS show "view2".
Why, why, WHYYYYYYYY?
What’s wrong?
Thanks