Example #1
0
 /**
  * @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');
         }
     }
 }
Example #2
0
 /**
  * @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');
         }
     }
 }
Example #3
0
 /**
  * @return array
  */
 public function UploadHelpdeskFile()
 {
     $oAccount = null;
     $oUser = $this->getHelpdeskAccountFromParam($oAccount);
     if (!$this->oApiCapability->isHelpdeskSupported() || !$this->oApiCapability->isFilesSupported()) {
         throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::AccessDenied);
     }
     $aFileData = $this->getParamValue('FileData', null);
     $iSizeLimit = 0;
     $sError = '';
     $aResponse = array();
     if ($oUser) {
         if (is_array($aFileData)) {
             if (0 < $iSizeLimit && $iSizeLimit < (int) $aFileData['size']) {
                 $sError = 'size';
             } else {
                 $sSavedName = 'upload-post-' . md5($aFileData['name'] . $aFileData['tmp_name']);
                 if ($this->ApiFileCache()->moveUploadedFile($oUser, $sSavedName, $aFileData['tmp_name'])) {
                     $sUploadName = $aFileData['name'];
                     $iSize = $aFileData['size'];
                     $sMimeType = \MailSo\Base\Utils::MimeContentType($sUploadName);
                     $aResponse['HelpdeskFile'] = array('Name' => $sUploadName, 'TempName' => $sSavedName, 'MimeType' => $sMimeType, 'Size' => (int) $iSize, 'Hash' => \CApi::EncodeKeyValues(array('TempFile' => true, 'HelpdeskTenantID' => $oUser->IdTenant, 'HelpdeskUserID' => $oUser->IdHelpdeskUser, 'Name' => $sUploadName, 'TempName' => $sSavedName)));
                 } else {
                     $sError = 'unknown';
                 }
             }
         } else {
             $sError = 'unknown';
         }
     } else {
         $sError = 'auth';
     }
     if (0 < strlen($sError)) {
         $aResponse['Error'] = $sError;
     }
     return $this->DefaultResponse($oAccount, __FUNCTION__, $aResponse);
 }
Example #4
0
 /**
  * @return bool
  */
 public function hasSslSupport()
 {
     return $this->oCapabilityApi->hasSslSupport();
 }