/**
  * Get the endpoint, username and password of the current site from custom 
  * Config Verb CUSTOM_CFG_EBS_Web_Service_Endpoint.
  * @return null
  */
 function checkExtIntegrationConfigVerb()
 {
     $url = $_SERVER['REQUEST_URI'];
     if (Text::beginsWith($url, '/app/error/')) {
         return;
     }
     // check if CUSTOM_CFG_EBS_Web_Service_Endpoint is defined in the current site
     if (IS_DEVELOPMENT === true && !defined('CUSTOM_CFG_Accel_Ext_Integrations')) {
         $this->log->error('CUSTOM_CFG_' . 'Accel_Ext_Integrations is not set', __METHOD__, array(null, $this->contact));
         Url::redirectToErrorPage(13);
     }
     // get the value of config verb CUSTOM_CFG_Accel_Ext_Integrations
     $config = RNCPHP\Configuration::fetch(CUSTOM_CFG_Accel_Ext_Integrations);
     $configVerb = json_decode($config->Value, true);
     if (is_null($configVerb)) {
         $this->log->error('Unable to get the value of CUSTOM_CFG_' . 'Accel_Ext_Integrations', __METHOD__, array(null, $this->contact), $config);
         Url::redirectToErrorPage(13);
     }
     // check if current site is defined in the config rnt_host
     $server = \RightNow\Utils\Config::getConfig(OE_WEB_SERVER);
     $hosts = $configVerb['hosts'];
     if (is_null($hosts)) {
         $this->log->error('Unable to find hosts inside CUSTOM_CFG_' . 'Accel_Ext_Integrations', __METHOD__, array(null, $this->contact), var_export($configVerb, true));
         Url::redirectToErrorPage(8);
     }
     foreach ($hosts as $host) {
         if ($server === $host['rnt_host']) {
             $this->extConfigVerb = $host;
             $this->extServerType = $host['integration']['server_type'];
             $this->rntHost = $host['rnt_host'];
             $this->ebsDefaultSROwnerID = $host['integration']['ebs_default_sr_owner_id'];
             return;
         }
     }
     // if no config verb match the current host
     $this->log->error("CUSTOM_CFG_Accel_Ext_Integrations :: host name isn't included in hosts", __METHOD__, array(null, $this->contact));
     Url::redirectToErrorPage(8);
 }
示例#2
0
 /**
  * fetch SR and check if the current user is the owner of the SR
  * @param int $srID Serivce Request ID
  * @return array|null Service Request detail
  */
 private function checkServiceRequest($srID)
 {
     if (!$srID) {
         $this->log->error('Invalid sr_id#{$srID}', __METHOD__, array(null, $this->contact));
         Url::redirectToErrorPage(10);
     }
     // check if contact party id and org id have been set
     if (!$this->CI->utility->validateSiebelContactID($this->contact)) {
         $this->log->error('contact_party_id and/or contact_org_id not provided', __METHOD__, array(null, $this->contact));
         Url::redirectToErrorPage(12);
     }
     // get SR by sr_id
     $getSRResult = $this->CI->model('custom/SiebelServiceRequest')->getSRDetailByID($srID);
     if ($getSRResult->error) {
         $this->log->error('Unable to get SR#{$srID}', __METHOD__, array(null, $this->contact));
         Url::redirectToErrorPage(11);
     }
     // check if the current user is the owner of the SR, if not, redirect to permission deny page
     $srDetail = $getSRResult->result;
     $contactPartyID = $this->contact !== null ? $this->contact->CustomFields->Accelerator->siebel_contact_party_id : null;
     if ($contactPartyID !== $srDetail['CONTACTID']) {
         $this->log->error('Permission Denied', __METHOD__, array(null, $this->contact), "ContactPartyID#{$contactPartyID} doesn't match SR.contactId #{$srDetail['CONTACT_PARTY_ID']}");
         Url::redirectToErrorPage(4);
     }
     return $srDetail;
 }