[Solved]User Access Level Error 403 Although Accessed By Admin

I wanted to make a user access level, but I have problem the admin (whose id_level = 1) still cannot access the specified page. Here I have EWebUser.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()




        return $user->id_level;

    return 100;




Then here is the accessRules method in UserController.php

public function accessRules()


    return array(


        array('allow', // allow admin user to perform 'admin' and 'delete' actions








I cannot access localhost/myappname/user.php, it throws error 403, although I logged in as Admin (id_level = 1). I figured out

$this->_model = User::model()->findByPk($this->id);

, I made change


because in my model the Primary key is




but it throws another error: Property "EWebUser.id_user" is not defined. Anyone can help me solve this problem? Thanks in advance.

[SOLVED] by myself, I 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 the actual problem is in the UserIdentity