Exemplo n.º 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]]);
     }
 }
 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;
 }
 /**
  * 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.');
     }
 }
Exemplo n.º 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 $principal_id
  * @param integer $subordinate_id
  * @param string $type
  * @param integer $action
  * @return Permission the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($principal_id, $subordinate_id, $type, $action)
 {
     if (($model = Permission::findOne(['principal_id' => $principal_id, 'subordinate_id' => $subordinate_id, 'type' => $type, 'action' => $action])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * 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();
     }
 }