I would like to know if it would be possible to assign a role (keep using rights extension) for a user, during the user creation, with an yii-user custom field (a dropdownlist menu of the roles defined in rights), and not through the rights administration panel.
in my case only the administrator can create new users, through the "create new user" function of yii-user extension.
i would like to have a new dropdown field, so i can decide which is the role given to the user during his creation. this role must be recorded in rights (table AuthAssignment).
this is good for populating my dropdown menu with rights role, but i need a way to save the role in rights model, so in AuthAssigment table (remember that the form that we are using is for creating yii-user user and not for managing rights role).
assuming $reader_role is what you get from the form submission
$user = new User;
// do the user stuff here:
...........
if($user->save()){
$auth=Yii::app()->authManager;
$auth->assign($reader_role,$user->id);
$this->redirect(array('view','id'=>$user->id));
}