/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = useraffiliation::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'exclude' => $this->exclude, 'delete_row' => $this->delete_row, 'id' => $this->id]); $query->andFilterWhere(['like', 'user_id', $this->user_id])->andFilterWhere(['like', 'group_name', $this->group_name])->andFilterWhere(['like', 'group_type', $this->group_type])->andFilterWhere(['like', 'created_by', $this->created_by])->andFilterWhere(['like', 'updated_by', $this->updated_by]); return $dataProvider; }
public static function findIdentity($id) { //CH CUSTOM /* //TEST WHEN THIS LOGIN ACTION FIRES $logger = \Yii::getLogger(); $logger->init(); $logger->flushInterval = 1; $logger->traceLevel = 0; $msg = "gms: User model, findIdentity() ... User is '" . (string)static::findOne($id)->id . "'"; $logger->log($msg . " (LG)", 4); */ //CH CUSTOM: This is an ideal point at which to gather information about the logged-in user //whether they enter credentials, or have their login credentials loaded from a cookie because they checked "Remember Me" when they last logged in. if (!empty(static::findOne($id)->id)) { //CH CUSTOM: Users who belong to a partner organization or project team need to have their views filtered //to exclude content outside the boundaries of their project or org. Affiliations are stored as App parameters (see params-local.php: 'affiliations' => array...) $user_affiliation = new useraffiliation(); $user_affiliation->user_id = (string) static::findOne($id)->id; //***See method getUserAffiliations() in UserAffiliation model: //***The logged-in user's affiliations are stored in App Params initialized in params-local.php in /common/config/. //************************************************** $affils = $user_affiliation->getUserAffiliations(); //************************************************** $user_affiliation = NULL; //Debug //$msg = "gms: user.php, findIdentity() ... App param for Current_Affiliation (AFTER getUserAffiliations): '" . implode(",", Yii::$app->params["current_affiliation"]; //$logger->log($msg . " (LG)", 4); } //$logger->flush(); //END CUSTOM return static::findOne($id); }