/** * @return array */ public function AjaxContactUpdate() { $oAccount = $this->getDefaultAccountFromParam(); $bGlobal = '1' === $this->getParamValue('Global', '0'); $sContactId = $this->getParamValue('ContactId', ''); $bSharedToAll = '1' === $this->getParamValue('SharedToAll', '0'); $iTenantId = $bSharedToAll ? $oAccount->IdTenant : null; if ($bGlobal && $this->oApiCapability->isGlobalContactsSupported($oAccount, true)) { $oApiContacts = $this->ApiGContacts(); } else { if (!$bGlobal && $this->oApiCapability->isPersonalContactsSupported($oAccount)) { $oApiContacts = $this->ApiContacts(); } } if ($oApiContacts) { $oContact = $oApiContacts->getContactById($bGlobal ? $oAccount : $oAccount->IdUser, $sContactId, false, $iTenantId); if ($oContact) { $this->populateContactObject($oContact, $oContact->ItsMe); if ($oApiContacts->updateContact($oContact)) { return $this->TrueResponse($oAccount, __FUNCTION__); } else { switch ($oApiContacts->getLastErrorCode()) { case \Errs::Sabre_PreconditionFailed: throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::ContactDataHasBeenModifiedByAnotherApplication); } } } } else { throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::ContactsNotAllowed); } return $this->FalseResponse($oAccount, __FUNCTION__); }
/** * @param string $path * @param \Sabre\DAV\INode $node * @param array $requestedProperties * @param array $returnedProperties * @return void */ public function beforeGetProperties($path, \Sabre\DAV\INode $node, &$requestedProperties, &$returnedProperties) { $oAccount = $this->getAccount(); if (isset($oAccount)) { $carddavPlugin = $this->getPlugin('Sabre\\CardDAV\\Plugin'); if (null !== $oAccount && isset($carddavPlugin) && $this->oApiCapaManager->isGlobalContactsSupported($oAccount, false)) { $carddavPlugin->directories = array('gab'); } } }
/** * @param string $path * @param \Sabre\DAV\INode $node * @param array $requestedProperties * @param array $returnedProperties * @return void */ public function beforeGetProperties($path, \Sabre\DAV\INode $node, &$requestedProperties, &$returnedProperties) { $iUserId = $this->getUser(); if (isset($iUserId)) { $carddavPlugin = $this->getPlugin('carddav'); if (isset($carddavPlugin) && $this->oApiCapaManager->isGlobalContactsSupported($iUserId, false)) { $carddavPlugin->directories = array('gab'); } } }