22 $this->_authorizer = $this->module->getAuthorizer();
23 $this->
layout = $this->module->layout;
24 $this->defaultAction =
'view';
27 $this->module->registerScripts();
35 return array(
'accessControl');
54 'users' => $this->_authorizer->getSuperusers(),
57 'users' => array(
'*'),
69 'pagination' => array(
75 $this->render(
'view', array(
76 'dataProvider' => $dataProvider,
86 $userClass = $this->module->userClass;
87 $model = CActiveRecord::model($userClass)->findByPk($_GET[
'id']);
88 $this->_authorizer->attachUserBehavior($model);
90 $assignedItems = $this->_authorizer->getAuthItems(null, $model->getId());
91 $assignments = array_keys($assignedItems);
95 if ($assignSelectOptions !== array()) {
99 if (isset($_POST[
'AssignmentForm']) ===
true) {
100 $formModel->attributes = $_POST[
'AssignmentForm'];
101 if ($formModel->validate() ===
true) {
103 $this->_authorizer->authManager->assign($formModel->itemname, $model->getId());
104 $item = $this->_authorizer->authManager->getAuthItem($formModel->itemname);
105 $item = $this->_authorizer->attachAuthItemBehavior($item);
107 Yii::app()->user->setFlash($this->module->flashSuccessKey,
108 Rights::t(
'core',
'Permission :name assigned.', array(
':name' => $item->getNameText()))
111 $this->redirect(array(
'assignment/user',
'id' => $model->getId()));
122 'userId' => $model->getId(),
126 $this->render(
'user', array(
128 'dataProvider' => $dataProvider,
129 'formModel' => $formModel,
130 'assignSelectOptions' => $assignSelectOptions,
140 if (Yii::app()->request->isPostRequest ===
true) {
144 $this->_authorizer->authManager->revoke($itemName, $_GET[
'id']);
145 $item = $this->_authorizer->authManager->getAuthItem($itemName);
146 $item = $this->_authorizer->attachAuthItemBehavior($item);
149 Yii::app()->user->setFlash($this->module->flashSuccessKey,
150 Rights::t(
'core',
'Permission :name revoked.', array(
':name' => $item->getNameText()))
154 if (isset($_POST[
'ajax']) ===
false) {
155 $this->redirect(array(
'assignment/user',
'id' => $_GET[
'id']));
158 throw new CHttpException(400,
Rights::t(
'core',
'Invalid request. Please do not repeat this request again.'));
167 return isset($_GET[
'name']) ===
true ? urldecode($_GET[
'name']) : null;