yii - User Access Level Error 403 Although Accessed by Admin -


i wanted make user access level, have problem admin (whose id_level = 1) still cannot access specified page. here have ewebuser.php

<?php class ewebuser extends cwebuser{  protected $_model;  protected function loaduser() {     if ( $this->_model === null ) {             $this->_model = user::model()->findbypk($this->id);     }     return $this->_model; }  function getlevel() {     $user=$this->loaduser();     if($user)         return $user->id_level;     return 100; } } ?> 

then here accessrules method in usercontroller.php

public function accessrules() {     return array(         .......         array('allow', // allow admin user perform 'admin' , 'delete' actions             'actions'=>array('index','admin','delete'),             //'users'=>array('admin'),             'expression'=>'$user->getlevel()<=1',         ),         .......     ); } 

i cannot access localhost/myappname/user.php, throws error 403, although logged in admin (id_level = 1). figured out $this->_model = user::model()->findbypk($this->id); , made change $this->id_user because in model primary key id_user not id throws error: property "ewebuser.id_user" not defined. can me solve problem? in advance..

[solved] myself, changed $this->_id = $user->username; $this->_id = $user->id_user; in useridentity.php, there's no wrong codes on $this->_model = user::model()->findbypk($this->id); because actual problem in useridentity


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -