示例#1
0
 /**
  * Gets a comma separated list of frontend user groups to use for the
  * document ID.
  *
  * @return string A comma separated list of frontend user groups.
  */
 protected function getDocumentIdGroups()
 {
     $groups = $this->pageAccessRootline->getGroups();
     $groups = Rootline::cleanGroupArray($groups);
     if (empty($groups)) {
         $groups[] = 0;
     }
     $groups = implode(',', $groups);
     return $groups;
 }
示例#2
0
 /**
  * Generates a page document's "Access Rootline".
  *
  * The Access Rootline collects frontend user group access restrcitions set
  * for pages up in a page's rootline extended to sub-pages.
  *
  * The format is like this:
  * pageId1:group1,group2|groupId2:group3|c:group1,group4,groupN
  *
  * The single elements of the access rootline are separated by a pipe
  * character. All but the last elements represent pages, the last element
  * defines the access restrictions applied to the page's content elements
  * and records shown on the page.
  * Each page element is composed by the page ID of the page setting frontend
  * user access restrictions, a colon, and a comma separated list of frontend
  * user group IDs restricting access to the page.
  * The content access element does not have a page ID, instead it replaces
  * the ID by a lower case C.
  *
  * @param Item $item Index queue item representing the current page
  * @param integer $language The sys_language_uid language ID
  * @param integer $contentAccessGroup The user group to use for the content access rootline element. Optional, will be determined automatically if not set.
  * @return string An Access Rootline.
  */
 protected function getAccessRootline(Item $item, $language = 0, $contentAccessGroup = null)
 {
     static $accessRootlineCache;
     $mountPointParameter = $this->getMountPageDataUrlParameter($item);
     $accessRootlineCacheEntryId = $item->getRecordUid() . '|' . $language;
     if ($mountPointParameter !== '') {
         $accessRootlineCacheEntryId .= '|' . $mountPointParameter;
     }
     if (!is_null($contentAccessGroup)) {
         $accessRootlineCacheEntryId .= '|' . $contentAccessGroup;
     }
     if (!isset($accessRootlineCache[$accessRootlineCacheEntryId])) {
         $accessRootline = \ApacheSolrForTypo3\Solr\Access\Rootline::getAccessRootlineByPageId($item->getRecordUid(), $mountPointParameter);
         // current page's content access groups
         $contentAccessGroups = array($contentAccessGroup);
         if (is_null($contentAccessGroup)) {
             $contentAccessGroups = $this->getAccessGroupsFromContent($item, $language);
         }
         $accessRootline->push(GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\Access\\RootlineElement', 'c:' . implode(',', $contentAccessGroups)));
         $accessRootlineCache[$accessRootlineCacheEntryId] = $accessRootline;
     }
     return $accessRootlineCache[$accessRootlineCacheEntryId];
 }
示例#3
0
 /**
  * @test
  * @dataProvider rootLineDataProvider
  */
 public function canParser($rootLineString, $expectedGroups)
 {
     $rootline = new Rootline($rootLineString);
     $groups = $rootline->getGroups();
     $this->assertSame($expectedGroups, $groups);
 }