public function actionList()
 {
     $data['authid'] = 0;
     if (isset($_GET['authid'])) {
         $data['authid'] = (int) $_GET['authid'];
     }
     $userCount = HrbacUserModel::getUserCount($data['authid']);
     $pageSize = 20;
     //TODO: Make this configurable or provide UI
     $data['widget'] = $this->createWidget('CLinkPager', array('itemCount' => $userCount, 'pageSize' => $pageSize));
     $currentPage = $data['widget']->getCurrentPage();
     if ($data['authid']) {
         $data['users'] = HrbacUserModel::getUsersByAuthId($data['authid'], $pageSize, $pageSize * $currentPage);
         $data['authitem'] = HrbacItemModel::model()->findByPk($data['authid']);
     } else {
         $data['users'] = HrbacUserModel::getUsers($pageSize, $pageSize * $currentPage);
     }
     $this->render('list', array('data' => $data));
 }
Beispiel #2
0
 static function getAuthItem($userid, $auth_id)
 {
     $sql = "\n\t\t\tSELECT au.*, u.username, i.name as authname, i.alt_name, i.type, i.description \n\t\t\tFROM " . Yii::app()->authManager->assignmentTable . " AS au, " . HrbacModule::$usersTable . " AS u, " . Yii::app()->authManager->itemTable . " AS i \n\t\t\tWHERE user_id = id AND au.auth_id=i.auth_id AND user_id=:userid AND au.auth_id=:itemid";
     $data = Yii::app()->authManager->db->createCommand($sql)->queryRow(true, array(':userid' => $userid, ':itemid' => $auth_id));
     $data['model'] = HrbacItemModel::model()->findByPk($auth_id);
     return $data;
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = HrbacItemModel::model()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }