/**
	* Update an auth item.
	* Note: The item's type can not be changed.
	*/
	public function actionManage($item) {
		$item = $this->authManager->getEAuthItem($item);
		if (empty($item))
			throw new CHttpException(404, Yii::t('RbamModule.rbam','Authorisation item not found.'));
			
		$authItem = new AuthItem('update'); // $authItem is a CFormModel
		$attributes = array();
  	foreach ($authItem->getAttributes() as $name=>$value)
	  	$authItem->$name = $item->$name;
	  
		$form = $authItem->getForm(!in_array($item->name, $this->getModule()->getDefaultRoles()));
		if ($form->submitted($form->uniqueId)) {
			$response = array();
			if ($authItem->save($item)) {
				$response['content'] = Yii::t('RbamModule.rbam','"{item}" {type} updated.', array(
					'{item}'=>$item->name,
					'{type}'=>$this->type($item->type, true)
				));
				if ($item->name!==$_POST['AuthItem']['oldName'])
					$response['redirect'] = $this->createUrl($this->action->id, array('item'=>$item->name));
			}
			else {
				$errors = array();
				foreach ($authItem->getErrors() as $attribute=>$attributeErrors)
					foreach ($attributeErrors as $error)
						$errors[] = array(
							'attribute'=>$attribute,
							'label'=>$authItem->getAttributeLabel($attribute),
							'error'=>$error
						);
				$response = compact('errors');
			}
			header('Content-type: application/json');
			echo CJSON::encode($response);
	  	Yii::app()->end();
		}
		
		if (Yii::app()->getUser()->checkAccess($this->getModule()->authAssignmentsManagerRole)) {
			$authAssignment = new AuthAssignment('upate'); // $authAssignment is a CFormModel
			$assignmentForm = $authAssignment->getForm();			
		}
		else
			$assignmentForm = null;

		$this->pageTitle = $this->_pageTitle($this->action->id, array(
			'{item}'=>$item->name,
			'{type}'=>$this->type($item->type, true, true)
		));
		$this->breadcrumbs = array(
			'RBAM'=>array('rbam/index'),
			$this->_pageTitle('index')=>array('index'),
			$this->pageTitle
		);

		$this->render('form', compact('item', 'form', 'assignmentForm'));
	}