Ejemplo n.º 1
0
 /**
  * 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));
     }
 }
 /**
  * Signal that is called for post-processing a matcher object.
  *
  * @param Matcher $matcher
  * @signal
  */
 protected function emitPostProcessMatcherObjectSignal(Matcher $matcher)
 {
     $this->getSignalSlotDispatcher()->dispatch(self::class, 'postProcessMatcherObject', array($matcher, $matcher->getDataType()));
 }
Ejemplo n.º 4
0
 /**
  * Computes the search constraint and returns it.
  *
  * @param Query $query
  * @param Matcher $matcher
  * @return ConstraintInterface|NULL
  */
 protected function computeSearchTermConstraint(Query $query, Matcher $matcher)
 {
     $result = NULL;
     // Search term case
     if ($matcher->getSearchTerm()) {
         $fields = GeneralUtility::trimExplode(',', Tca::table($this->dataType)->getSearchFields(), TRUE);
         $constraints = array();
         $likeClause = sprintf('%%%s%%', $matcher->getSearchTerm());
         foreach ($fields as $fieldNameAndPath) {
             if ($this->isSuitableForLike($fieldNameAndPath, $matcher->getSearchTerm())) {
                 $dataType = $this->getFieldPathResolver()->getDataType($fieldNameAndPath, $this->dataType);
                 $fieldName = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath, $this->dataType);
                 if (Tca::table($dataType)->hasField($fieldName) && Tca::table($dataType)->field($fieldName)->hasRelation()) {
                     $foreignTable = Tca::table($dataType)->field($fieldName)->getForeignTable();
                     $fieldNameAndPath = $fieldNameAndPath . '.' . Tca::table($foreignTable)->getLabelField();
                 }
                 $constraints[] = $query->like($fieldNameAndPath, $likeClause);
             }
         }
         $logical = $matcher->getLogicalSeparatorForSearchTerm();
         $result = $query->{$logical}($constraints);
     }
     return $result;
 }
Ejemplo n.º 5
0
 /**
  * Signal that is called for post-processing a matcher object.
  *
  * @param Matcher $matcher
  * @signal
  */
 protected function emitPostProcessMatcherObjectSignal(Matcher $matcher)
 {
     if (strlen($matcher->getDataType()) <= 0) {
         /** @var ModuleLoader $moduleLoader */
         $moduleLoader = $this->getObjectManager()->get('Fab\\Vidi\\Module\\ModuleLoader');
         $matcher->setDataType($moduleLoader->getDataType());
     }
     $this->getSignalSlotDispatcher()->dispatch('Fab\\Vidi\\Controller\\Backend\\ContentController', 'postProcessMatcherObject', array($matcher, $matcher->getDataType()));
 }