Ejemplo n.º 1
0
Archivo: Cxn.php Proyecto: kidaa30/yes
 /**
  * Construct a client for performing registration actions.
  *
  * @return \Civi\Cxn\Rpc\RegistrationClient
  * @throws CRM_Core_Exception
  */
 public static function createRegistrationClient()
 {
     $cxnStore = new \CRM_Cxn_CiviCxnStore();
     $client = new \Civi\Cxn\Rpc\RegistrationClient($cxnStore, \CRM_Cxn_BAO_Cxn::getSiteCallbackUrl());
     $client->setLog(new \CRM_Utils_SystemLogger());
     $client->setCertValidator(self::createCertificateValidator());
     $client->setHttp(CRM_Cxn_CiviCxnHttp::singleton());
     return $client;
 }
Ejemplo n.º 2
0
/**
 *
 * @param array $params
 * @return array
 * @throws Exception
 */
function civicrm_api3_cxn_getcfg($params)
{
    $result = array('CIVICRM_CXN_CA' => defined('CIVICRM_CXN_CA') ? CIVICRM_CXN_CA : NULL, 'CIVICRM_CXN_VIA' => defined('CIVICRM_CXN_VIA') ? CIVICRM_CXN_VIA : NULL, 'CIVICRM_CXN_APPS_URL' => defined('CIVICRM_CXN_APPS_URL') ? CIVICRM_CXN_APPS_URL : NULL, 'siteCallbackUrl' => CRM_Cxn_BAO_Cxn::getSiteCallbackUrl());
    return civicrm_api3_create_success($result);
}
Ejemplo n.º 3
0
/**
 *
 * @param array $params
 * @return array
 * @throws Exception
 */
function civicrm_api3_cxn_getcfg($params)
{
    $result = array('CIVICRM_CXN_CA' => defined('CIVICRM_CXN_CA') ? CIVICRM_CXN_CA : NULL, 'CIVICRM_CXN_VIA' => defined('CIVICRM_CXN_VIA') ? CIVICRM_CXN_VIA : NULL, 'CIVICRM_CXN_APPS_URL' => defined('CIVICRM_CXN_APPS_URL') ? CIVICRM_CXN_APPS_URL : NULL, 'siteCallbackUrl' => CRM_Cxn_BAO_Cxn::getSiteCallbackUrl());
    return civicrm_api3_create_success($result);
    $cxnId = _civicrm_api3_cxn_parseCxnId($params);
    $appMeta = CRM_Cxn_BAO_Cxn::getAppMeta($cxnId);
    if (empty($params['page']) || !is_string($params['page'])) {
        throw new API_Exception("Invalid page");
    }
    /** @var \Civi\Cxn\Rpc\RegistrationClient $client */
    $client = \Civi\Core\Container::singleton()->get('cxn_reg_client');
    return $client->call($appMeta, 'Cxn', 'getlink', array('page' => $params['page']));
}
Ejemplo n.º 4
0
 /**
  * @param CRM_Cxn_DAO_Cxn $dao
  * @return array
  *   Array-encoded connection details.
  */
 protected function convertDaoToCxn($dao)
 {
     $appMeta = json_decode($dao->app_meta, TRUE);
     return array('cxnId' => $dao->cxn_guid, 'secret' => $dao->secret, 'appId' => $dao->app_guid, 'appUrl' => $appMeta['appUrl'], 'siteUrl' => CRM_Cxn_BAO_Cxn::getSiteCallbackUrl(), 'perm' => json_decode($dao->perm, TRUE));
 }