Exemplo n.º 1
0
 public function before($context)
 {
     /*{{{*/
     $curOperator = DAL::get()->find("TeleOperator", $context->request->getCookie('operator'));
     /**
      * 如果没有登录,调到登录页面 
      */
     if ($curOperator->isNull()) {
         header('Location:http://' . URL_PREFIX . 'callcenter.haodf.com/operator/login');
         exit;
     }
     $bk = $context->request->getCookie('bk');
     $ip = RequestDelegate::getIp();
     $session = SessionDefault::singleton();
     /**
      * 网站用户已登录,而且允许在外网访问管理后台
      * 或者
      * 是超级管理员
      * 可以在外放访问呼叫中心
      */
     if (false == RequestDelegate::isOfficeIp()) {
         if ($bk && isset($session->UserId) && BackYardAuth::authVerificationCode($bk, $session->UserId, $ip) || $curOperator->isSupperAdmin()) {
         } else {
             echo "本系统只允许在办公室内使用!";
             exit;
         }
     }
 }
Exemplo n.º 2
0
 private function buildOptions(&$params)
 {
     /*{{{*/
     $options = array();
     //是否cache
     if (isset($params['nocache'])) {
         $options['nocache'] = $params['nocache'];
         unset($params['nocache']);
     }
     //强制走master,忽略缓存
     if (isset($_GET['_m_m_']) || isset($_POST['_m_m_']) || isset($_GET['nocache']) && RequestDelegate::isOfficeIp()) {
         $options['_master_'] = true;
         $options['nocache'] = true;
     }
     //是否独占
     if (isset($params['synchronized'])) {
         $options['synchronized'] = $params['synchronized'];
         unset($params['synchronized']);
         if (isset($params['synchronizedKey'])) {
             $options['synchronizedKey'] = $params['synchronizedKey'];
             unset($params['synchronizedKey']);
         }
     }
     //是否单独设置超时时间
     if (isset($params['timeout'])) {
         $options['timeout'] = $params['timeout'];
         unset($params['timeout']);
     }
     return $options;
 }
 public function before($context)
 {
     $userId = $context->request->userId;
     $user = DAL::get()->find('user', $userId);
     $action = strtolower($context->request->action);
     $os = $context->request->os;
     $ver = $context->request->v;
     if(false !== strpos($action, 'doctoruser') || false !== strpos($action, 'main') || $context->request->xdoc || false !== strpos($action, 'flowref_uploadsound'))
     {
     }
     else
     {
         if ($user->isNull() || $user->getCertificateForMobile() != $context->request->certificateToken)
         {
             $this->echoErrorCode();
         }
         if($user->hasSpace())
         {
             $space = $user->getSpace();
             if($user->name != 'malijuanmlj' && $space->host instanceof Doctor && $space->host->hospitalfaculty->hospital->isInnerTestHospital() && false == RequestDelegate::isOfficeIp())
             {
                 $this->echoErrorCode();
             }
         }
         //绑定设备验证                                                                                                                                                    
         if ($os == 'ios' && $ver >= '3.0.3' || $os == 'android' && $ver >= '3.0.8') 
         {
             $deviceToken = $os == 'ios' ? $context->request->deviceOpenUDID : $context->request->deviceToken;
             $doctorUser = DAL::get()->find_by_userid_and_status('doctoruser', $userId, DoctorUser::STATUS_BIND, true);
             if($doctorUser->isNull() == false && $doctorUser->deviceToken != $deviceToken && false == in_array($userId, DoctorUser::$doctorId4Test))
             {
                 $msg = "您的账号于 ".date('H:m', strtotime($doctorUser->ctime))." 在一台 ".$doctorUser->deviceType." 手机登录。如非本人操作,则密码可能已泄露,建议重新登录修改密码或直接联系我们 ".HdfPhoneNumber::PHONE_DOCTORHELP." 修改密码";
                 $msg = XString::convertToUnicode($msg);
                 echo '{"errorCode":"888","msg":"'.$msg.'","content":[]}';
                 exit;
             }
         }
     }
     if (($os == 'ios' && $ver >= '3.0.1' || $os == 'android' && $ver >= '3.0.5') && $this->actionIsNotInActions($context->action)) 
     {
         if ($user->id == 0) return;//用户id是0 的过滤
         $doctorOwner = DAL::get()->find_by_userid('DoctorOwner', $user->id);
         if (false == $doctorOwner->isNull() && $doctorOwner->isPreDoctor())
         {
             $predoctor = $doctorOwner->source;
             if ($predoctor->isRefused())
             {
                 echo '{"errorCode":"8000","msg":"","content":[]}';
                 exit;
             }
             if ($predoctor->isAbnormal())
             {
                 echo '{"errorCode":"8001","msg":"","content":[]}';
                 exit;
             }
         }
     }
 }
 public function sendVerificationCodeEmail($request, $response)
 {
     /*{{{*/
     if (false == RequestDelegate::isOfficeIp()) {
         echo '系统错误,请联系技术人员!!!';
         exit;
     }
     PrivilegeClient::getInstance()->sendVerificationCodeEmail($request->emailaddress, XDateTime::valueOf($request->starttime), XDateTime::valueOf($request->endtime));
     $response->setRedirect($response->router->urlfor('backyardauth/applytoken?st=ok'));
 }
Exemplo n.º 5
0
 public function before($context) 
 {/*{{{*/
     //$ip = RequestDelegate::getIp();
     //$userInfo = $context->request->getCookie('userinfo');
     if(false == RequestDelegate::isOfficeIp())
     {
         echo 'ÎÞЧµÄ·ÃÎÊ£¡';
         exit;
     }
 }/*}}}*/
    private function validTesterDoctor($request)
    {
		$doctorId = (int)Codec::getInstance()->decodeId($request->id);
        $doctor = DAL::get()->find('Doctor', $doctorId);
    	if($doctor->isNull() == false && $doctor->hospitalfaculty->hospital->isInnerTestHospital() && false == RequestDelegate::isOfficeIp())
        {
    		header('Location: http://www.haodf.com');
			exit;
    	}
    }
Exemplo n.º 7
0
	public function before($context)
	{
        $ip = RequestDelegate::getIp();
        $userInfo = $context->request->getCookie('userinfo');
        if(isset($_COOKIE['bk']) && isset($userInfo['id']) && BackYardAuth::authVerificationCode($_COOKIE['bk'], $userInfo['id'], $ip))
        {
        }
        else if(false == RequestDelegate::isOfficeIp())
        {
            echo '系统错误,请联系技术人员!!!';exit;
        }
    }
    public function before($context) 
    {
        $userInfo = $context->request->getCookie('userinfo');
        $userId = isset($userInfo['id'])?$userInfo['id']:0;
        if ($this->backYardAuth($context))
        {

        }
        else if(false == RequestDelegate::isOfficeIp() || 0 == $userId)
        {
            echo '系统错误,请联系技术人员!!!';exit;
        }
    }
    public function before($context) 
    {
    	$spaceUserName = WebUtil::getSpaceUserName($context->request);
    	$space = SpaceClient::getInstance()->getSpaceByUserName($spaceUserName);
        /**
         * 测试医院下所有space只能在办公区访问 
         *
         **/
    	$userId = UserClient::getInstance()->getCheckedSeed('id');
    	$user = DAL::get()->find('user', $userId);
        $hdferUserNames = array('verygoodman', 'willowliu', 'dvsj', 'yangshiqi');
        if(in_array($user->name, $hdferUserNames) == false && $space->host instanceof Doctor && $space->host->hospitalfaculty->hospital->isInnerTestHospital() && false == RequestDelegate::isOfficeIp())
        {
    		header('Location: http://www.haodf.com');
			exit;
    	}
    }
Exemplo n.º 10
0
	public function simpleDetail($request, $response)
	{/*{{{*/
		header('Content-Type: text/html; charset=gb2312');
        $spaceId = $request->getRequest('spaceId', 0);
        $response->spaceId = $spaceId;
        $from = $request->getRequest('from', '');

		$idStr = $request->ids;
		$ids = explode(',', $idStr);
		
		$paList = DAL::get()->find('PatientAttachment', $ids);
        $canViewPa = false;
        $anyPa = NullEntity::create();
		foreach($paList as $index => $pa)
		{
			if($pa->isNull() || $pa->isDeleted() && empty($spaceId))
				unset($paList[$index]);
            $anyPa = $pa;
		}
        //医生和患者本人可以看到附件
        if (false == $this->_newUser->isNull() && false == $anyPa->isNull())
        {
            if ($this->_newUser->id == $pa->user->id || $this->_newUser->id === $spaceId)
            {
                $canViewPa = true;
            }
            else if (RequestDelegate::isOfficeIp() && self::isAuditorPage())
            {
                //管理员在公司ip内也可以看到
                $curInspector = DAL::get()->find_by_userid('inspector', $this->_newUser->id); 
                if ($curInspector instanceOf inspector)
                {
                    $canViewPa = true;
                }
            }
        }
        $response->canViewPa = $canViewPa;
		$response->paList = $paList;
        if ($from)
        {
            return "detail4dzone";
        }
        return "default";
	}/*}}}*/