I have installed rights extension. It is working fine, I can access rights panel with admin/admin.
Rights has created two roles: authenticated and guest. I manually assigned permissions to each role.
However, I want logged in users to be ‘Authenticated’ role. How can I assign it automatically? I don’t want to click for each new user in back panel to assign them to ‘Authenticated’ role.
//THIS IS User/Create
public function actionCreate()
{
$model=new User;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['User']))
{
$model->attributes=$_POST['User'];
if($model->save())
{
//ADD ROLE FOR NEW USER
Rights::assign('Authenticated',$model->iduser); //This assigns role to new user!
$this->redirect(array('view','id'=>$model->iduser));
}
}
$this->render('create',array(
'model'=>$model,
));
}
But now, how to assign Guest role to users who have not logged in?