예제 #1
0
 /**
  * @param CAccount $oAccount
  * @param bool $bThrowAuthExceptionOnFalse Default value is **true**.
  *
  * @return \CHelpdeskUser|null
  */
 protected function getHelpdeskAccountFromParam($oAccount, $bThrowAuthExceptionOnFalse = true)
 {
     $oResult = null;
     $oAccount = null;
     if ('0' === (string) $this->getParamValue('IsExt', '1')) {
         $oAccount = $this->getDefaultAccountFromParam($bThrowAuthExceptionOnFalse);
         if ($oAccount && $this->oApiCapability->isHelpdeskSupported($oAccount)) {
             $oResult = $this->GetHelpdeskAccountFromMainAccount($oAccount);
         }
     } else {
         $mTenantID = $this->oApiIntegrator->getTenantIdByHash($this->getParamValue('TenantHash', ''));
         if (is_int($mTenantID)) {
             $oResult = \api_Utils::GetHelpdeskAccount($mTenantID);
         }
     }
     if (!$oResult && $bThrowAuthExceptionOnFalse) {
         throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::UnknownError);
     }
     return $oResult;
 }