/** * A method to connect the OAP platform and the account Id to OAC * * Note: The mapper method is always called using admin ID and type, just in case it needs * M2M authorithation itself * * @return mixed The M2M password if OAP and it's account is correctly connected to OAC, * PEAR_Error otherwise */ function connectM2M() { // Perform backup $accountId = $this->accountId; $accountType = $this->accountType; // Force Admin user $this->accountId = 0; $this->accountType = OA_ACCOUNT_ADMIN; // Actual call $result = $this->oMapper->connectM2M($accountId, $accountType); // Restore $this->accountId = $accountId; $this->accountType = $accountType; if (PEAR::isError($result)) { return $result; } // Store M2M password OA_Dal_Central_M2M::setM2MPassword($this->accountId, $result); if (isset($GLOBALS['OX_CLEAR_M2M_PASSWORD'][$this->accountId])) { unset($GLOBALS['OX_CLEAR_M2M_PASSWORD'][$this->accountId]); } return $result; }
/** * A private method to call the reconnectM2M method and store the new password * * @return mixed True on success, PEAR_Error otherwise */ function _reconnectM2M() { $result = $this->callM2M('reconnectM2M'); if (PEAR::isError($result)) { return $result; } OA_Dal_Central_M2M::setM2MPassword($this->oCentral->accountId, $result); return true; }