But I don’t want save this field. If I just remove input field from my form, there is possible to change my html form and submit to save this parameter
Yes, but then I should define every field in controller which I want to save and it is extra code in controller and one scenario form could be in multiple controllers. Because of that I want to define in scenario which field could be saved and continue using $form->attributes=$_POST[‘User’];
en … may be you should design your own solution , it’s not too hard to mimic the
CActiveRecord::setAttributes() , some pseudocode:
protected function myMassiveAssignment($model,array $attrs){
$userGroupPerms['group1'] = array(
'attr1','attr4','attrx'
);
$userGroupPerms['group2'] = array(
'attr1','attr2','attrx','attr9'
); // .... these can be hard code or from another method or even from you db table
$attributeNames = $modle->attributeNames();
$userGroup = Yii::app()->user->getGroupName();
if(isset($userGroupPerms[$userGroup])){
/* just use loop logic to assign the attributes which exist in $userGroupPerms[$userGroup] , refer to the
http://www.yiiframework.com/doc/api/1.1/CModel#setAttributes-detail
*/
}else{
//deny or allow all
}
}
just for thinking , if you can not find any existing solution you must settle your owner way