/** * Update a user::role assignment. * The only attributes that can be changed are bizrule and data. * Ajax only method */ public function actionUpdate() { $authAssignment = new AuthAssignment('upate'); // $authAssignment is a CFormModel $form = $authAssignment->getForm(); if ($form->submitted($form->uniqueId)) { // there is no submit button from the juiDialog, so use the form id $response = array(); if ($authAssignment->save()) { $response['content'] = Yii::t('RbamModule.rbam', '"{user}::{role}" assignment updated.', array('{role}' => $authAssignment->itemName, '{user}' => $authAssignment->userName)); } else { $errors = array(); foreach ($authAssignment->getErrors() as $attribute => $attributeErrors) { foreach ($attributeErrors as $error) { $errors[] = array('attribute' => $attribute, 'label' => $authAssignment->getAttributeLabel($attribute), 'error' => $error); } } $response = compact('errors'); } header('Content-type: application/json'); echo CJSON::encode($response); Yii::app()->end(); } }