28 $this->_authorizer = $this->module->getAuthorizer();
29 $this->layout = $this->module->layout;
30 $this->defaultAction =
'view';
33 $this->module->registerScripts();
41 return array(
'accessControl');
58 'users'=>$this->_authorizer->getSuperusers(),
79 $this->render(
'view', array(
80 'dataProvider'=>$dataProvider,
90 $userClass = $this->module->userClass;
91 $model = CActiveRecord::model($userClass)->findByPk($_GET[
'id']);
92 $this->_authorizer->attachUserBehavior($model);
94 $assignedItems = $this->_authorizer->getAuthItems(null, $model->getId());
95 $assignments = array_keys($assignedItems);
99 if( $assignSelectOptions!==array() )
104 if( isset($_POST[
'AssignmentForm'])===
true )
106 $formModel->attributes = $_POST[
'AssignmentForm'];
107 if( $formModel->validate()===true )
110 $this->_authorizer->authManager->assign($formModel->itemname, $model->getId());
111 $item = $this->_authorizer->authManager->getAuthItem($formModel->itemname);
112 $item = $this->_authorizer->attachAuthItemBehavior($item);
114 Yii::app()->user->setFlash($this->module->flashSuccessKey,
115 Rights::t(
'core',
'Permission :name assigned.', array(
':name'=>$item->getNameText()))
119 array( !$this->invoker ?
'assignment/user' :
"/{$this->invoker->module->id}/assignment/user",
'id'=>$model->getId())
132 'userId'=>$model->getId(),
137 $this->render(
'user', array(
139 'dataProvider'=>$dataProvider,
140 'formModel'=>$formModel,
141 'assignSelectOptions'=>$assignSelectOptions,
151 if( Yii::app()->request->isPostRequest===
true )
156 $this->_authorizer->authManager->revoke($itemName, $_GET[
'id']);
157 $item = $this->_authorizer->authManager->getAuthItem($itemName);
158 $item = $this->_authorizer->attachAuthItemBehavior($item);
161 Yii::app()->user->setFlash($this->module->flashSuccessKey,
162 Rights::t(
'core',
'Permission :name revoked.', array(
':name'=>$item->getNameText()))
166 if( isset($_POST[
'ajax'])===false )
167 $this->redirect(array(!$this->invoker ?
'assignment/user' :
"/{$this->invoker->module->id}/assignment/user",
'id'=>$_GET[
'id']));
171 throw new CHttpException(400,
Rights::t(
'core',
'Invalid request. Please do not repeat this request again.'));
180 return isset($_GET[
'name'])===
true ? urldecode($_GET[
'name']) : null;