Using actionAdmin for both admin and non-admin users

Hi everyone,

The generated actionAdmin works only if you are an admin, but I want to use it for non-admin user too.

So what I need help in is how to get the model depending on the role:

admin => should see all the real estates entries

non-admin => should only see his own real estates entries

The actionAdmin is:




public function actionAdmin() 

{

	$model=new RealEstate('search');

	$model->unsetAttributes();  // clear any default values

	if(isset($_GET['RealEstate']))

	    $model->attributes=$_GET['RealEstate'];


        $this->render('admin',array('model'=>$model,));		

}



http://www.ramirezcobos.com/2011/04/20/implementing-a-user-level-access-system/