Error 403 You are not authorized to perform this action in yii framework -
i have followed http://www.larryullman.com/2010/01/04/simple-authentication-with-the-yii-framework/ creating login system using database.
after login , trying access admin pages got
error 403 not authorized perform action
idea why how solve issue?
see access rule
public function accessrules() { return array( array('allow', // allow users perform 'index' , 'view' actions 'actions'=>array('index','view'), 'users'=>array(''), ), array('allow', // allow authenticated user perform 'create' , 'update' actions 'actions'=>array(), 'users'=>array('@'), ), array('allow', // allow admin user perform 'admin' , 'delete' actions 'actions'=>array('admin','delete','create','update' ), // 'users'=>array('admin'), 'expression'=>'isset($user->role) && ($user->role==="admin")', ), array('deny', // deny users 'users'=>array(''), ), ); }
1- make sure accessrules() has allowed admin action & (signed in), , on top of other rules or @ least put on top of deny rule. don't me wrong, not required on top of other rules, default last rule in book deny *, if put admin rule below it, won't have chance access action admin.
public function accessrules() { return array( array('allow', // allow users perform 'index' , 'view' actions 'actions'=>array('index','view', 'checkout'), 'users'=>array('*'), ) ); }
2- if have correctly updated accessrules(), need check make sure account you're using sign in, user has access admin pages. operation in task user management, , assigned role owner. user must owner of project you're browse. go selecting database make sure on that.
Comments
Post a Comment