/** * Post-process the matcher object to respect the file storages. * * @param Matcher $matcher * @param string $dataType * @return void */ public function addFilePermissionsForFileStorages(Matcher $matcher, $dataType) { if ($dataType === 'sys_file' && $this->isPermissionNecessary()) { if ($this->isFolderConsidered()) { $folder = $this->getMediaModule()->getCurrentFolder(); if ($this->getMediaModule()->hasRecursiveSelection()) { // Only add like condition if needed. if ($folder->getStorage()->getRootLevelFolder() !== $folder) { $matcher->like('identifier', $folder->getIdentifier() . '%', $automaticallyAddWildCard = FALSE); } } else { // Browse only currently $files = $this->getFileUids($folder); $matcher->in('uid', $files); } $matcher->equals('storage', $folder->getStorage()->getUid()); } else { $storage = $this->getMediaModule()->getCurrentStorage(); // Set the storage identifier only if the storage is on-line. $identifier = -1; if ($storage->isOnline()) { $identifier = $storage->getUid(); } if ($this->getModuleLoader()->hasPlugin() && !$this->getCurrentBackendUser()->isAdmin()) { $fileMounts = $this->getCurrentBackendUser()->getFileMountRecords(); $collectedFiles = array(); foreach ($fileMounts as $fileMount) { $combinedIdentifier = $fileMount['base'] . ':' . $fileMount['path']; $folder = ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($combinedIdentifier); $files = $this->getFileUids($folder); $collectedFiles = array_merge($collectedFiles, $files); } $matcher->in('uid', $collectedFiles); } $matcher->equals('storage', $identifier); } } }
/** * Post-process the matcher object to respect the file storages. * * @param Matcher $matcher * @param string $dataType * @return void */ public function addUsergroupConstraint(Matcher $matcher, $dataType) { if ($dataType === 'fe_users' && $GLOBALS['_SERVER']['REQUEST_METHOD'] === 'GET' && $this->getModuleLoader()->getSignature() === 'easyvote_VidiFeUsersM1') { $matcher->in('usergroup.uid', array(9, 10)); } }
/** * Apply criteria specific from folder given as settings. * * @param Matcher $matcher * @return Matcher $matcher */ protected function applyCriteriaFromFolders(Matcher $matcher) { if (!empty($this->settings['folders'])) { $folderIdentifiers = GeneralUtility::trimExplode(',', $this->settings['folders'], true); $fileUids = []; foreach ($folderIdentifiers as $folderIdentifier) { $folderIdentifier = str_replace('file:', '', $folderIdentifier); $folder = ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($folderIdentifier); $files = $folder->getFiles(); foreach ($files as $file) { $fileUids[] = $file->getUid(); } } $matcher->in('uid', $fileUids); } return $matcher; }
/** * Apply criteria specific to jQuery plugin Datatable. * * @param Matcher $matcher * @param array $matches * @return Matcher $matcher */ protected function applyCriteriaFromMatchesArgument(Matcher $matcher, $matches) { foreach ($matches as $fieldNameAndPath => $value) { // CSV values should be considered as "in" operator in Query, otherwise "equals". $explodedValues = GeneralUtility::trimExplode(',', $value, TRUE); if (count($explodedValues) > 1) { $matcher->in($fieldNameAndPath, $explodedValues); } else { $matcher->equals($fieldNameAndPath, $explodedValues[0]); } } return $matcher; }