コード例 #1
0
 private function permissiondataprovider($groups, $userId = 0)
 {
     if ($userId) {
         return new ActiveDataProvider(['query' => Permission::find()->where(['groupId' => $groups, 'status' => 1])->orWhere(['userId' => $userId]), 'pagination' => ['pageSize' => -1]]);
     } else {
         return new ActiveDataProvider(['query' => Permission::find()->where(['groupId' => $groups, 'status' => 1]), 'pagination' => ['pageSize' => -1]]);
     }
 }
コード例 #2
0
 public function search($params)
 {
     $query = Permission::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['Id' => $this->Id, 'userId' => $this->userId, 'groupId' => $this->groupId, 'createdOn' => $this->createdOn, 'createdBy' => $this->createdBy, 'updatedOn' => $this->updatedOn, 'updatedBy' => $this->updatedBy, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'module', $this->module])->andFilterWhere(['like', 'controller', $this->controller])->andFilterWhere(['like', 'action', $this->action]);
     return $dataProvider;
 }
コード例 #3
0
 /**
  * Finds the Permission model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Permission the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Permission::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #4
0
 /**
  * Finds the Permission model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Permission the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Permission::findOne($id)) !== null) {
         return $model;
     } else {
         return new Permission();
     }
 }