Hi guys How to create access role in yii and where in yii application part ? I want to create access role in yii application but i have a problem and dont know about where to assign role in yii like i have three department role 1.admin -: admin have a all access role in our application 2.staff -: staff same of page and access role like to edit or update 3.user -: user have a all access page only viewing in our application These type of role can set in controller but i can justify where to write all access in yii and how to set access role , thank hari maliya
Page 1 of 1
How To Create Access Role In Yii ?
#1
Posted 07 January 2013 - 08:35 AM
#2
Posted 07 January 2013 - 06:52 PM
Hi,
Yii offers you a plenty of nice tools: see filters, auth .... See also auth category of extensions.
Cheers.
Yii offers you a plenty of nice tools: see filters, auth .... See also auth category of extensions.
Cheers.
Hey Ho !
Let's go !
Let's go !
#3
Posted 10 January 2013 - 01:10 AM
hi this is Arun from India . i created new blog after studying yiiblog i am getting
error while creating a new "Post"
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`blog`.`tbl_post`, CONSTRAINT `FK_post_author` FOREIGN KEY (`author_id`) REFERENCES `tbl_user` (`id`) ON DELETE CASCADE). The SQL statement executed was: INSERT INTO `tbl_post` (`title`, `content`, `tags`, `status`, `create_time`, `update_time`, `author_id`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6)
error while creating a new "Post"
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`blog`.`tbl_post`, CONSTRAINT `FK_post_author` FOREIGN KEY (`author_id`) REFERENCES `tbl_user` (`id`) ON DELETE CASCADE). The SQL statement executed was: INSERT INTO `tbl_post` (`title`, `content`, `tags`, `status`, `create_time`, `update_time`, `author_id`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6)
#4
Posted 14 May 2013 - 12:18 AM
here any example to create Access Rules ...
echo Yii::app()->user->getState('roles');
public function accessRules()
{
return array(
array('allow', //allow admin user to perform 'index'&'view' actions
'actions'=>array('index','view'),
'users'=>array('admin'),
'roles'=>array('admin'),
),
);
}
echo Yii::app()->user->getState('roles');
public function accessRules()
{
return array(
array('allow', //allow admin user to perform 'index'&'view' actions
'actions'=>array('index','view'),
'users'=>array('admin'),
'roles'=>array('admin'),
),
);
}
Share this topic:
Page 1 of 1

Help











