public function beforeAction($action) { if (parent::beforeAction($action)) { $group = Yii::app()->session['group']; $userInfo = Yii::app()->session['userInfo']; // if (strpos($group[$userInfo['groupId']]->action, Yii::app()->controller->id) || strpos($group[$userInfo['groupId']]->action, $action->id) === false) { // ShowMessage::error('无权限使用此功能,请升级你的账号!'); // } $paramId = intval(Yii::app()->request->getParam('wechatId', 0)); $wechatId = $paramId ? $paramId : Yii::app()->session['wechatId']; if ($paramId) { Yii::app()->session['wechatId'] = $paramId; } $this->wechatInfo = $this->_getWechatInfo($wechatId); Yii::app()->session['isAuth'] = $this->wechatInfo->isAuth; } return true; }
protected function beforeAction($event) { $role = Yii::app()->user->role_id; if ($role != ROLE_LANDLORD) { switch ($role) { case ROLE_REGISTER_MEMBER: $this->redirect(Yii::app()->createAbsoluteUrl('member/member_profile/myprofile')); break; case ROLE_TENANT: $this->redirect(Yii::app()->createAbsoluteUrl('member/tenant/property')); break; case ROLE_AGENT: $this->redirect(Yii::app()->createAbsoluteUrl('member/dashboard')); break; } } return parent::beforeAction($event); }
protected function beforeAction($event) { $role = Yii::app()->user->role_id; $aActionNotCheck = array('delete'); $cAction = Yii::app()->controller->action->id; if ($role != ROLE_TENANT && !in_array($cAction, $aActionNotCheck)) { switch ($role) { case ROLE_REGISTER_MEMBER: $this->redirect(Yii::app()->createAbsoluteUrl('member/member_profile/myprofile')); break; case ROLE_LANDLORD: $this->redirect(Yii::app()->createAbsoluteUrl('member/landlord/property')); break; case ROLE_AGENT: $this->redirect(Yii::app()->createAbsoluteUrl('member/dashboard')); break; } } return parent::beforeAction($event); }