Ejemplo n.º 1
0
 /**
  * @test
  */
 public function removeUsergroupRemovesUsergroup()
 {
     $usergroup = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup('foo');
     $this->fixture->addUsergroup($usergroup);
     $this->assertEquals(count($this->fixture->getUsergroup()), 1);
     $this->fixture->removeUsergroup($usergroup);
     $this->assertEquals(count($this->fixture->getUsergroup()), 0);
 }
Ejemplo n.º 2
0
 /**
  * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
  */
 public function getBookmarksForCurrentConfigAndFeUser()
 {
     $allBookmarks = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     if ($this->bookmarkConfiguration->getShowPrivateBookmarks() && $this->feUser != NULL) {
         $privateBookmarks = $this->bookmarkRepository->findPrivateBookmarksByFeUserAndListIdentifier($this->feUser, $this->listIdentifier);
         $this->addObjectsToObjectStorageByArray($allBookmarks, $privateBookmarks);
     }
     if ($this->bookmarkConfiguration->getShowGroupBookmarks() && $this->feUser != NULL && count($this->feUser->getUsergroup()) > 0) {
         $groupBookmarks = $this->bookmarkRepository->findGroupBookmarksByFeUserAndListIdentifier($this->feUser, $this->listIdentifier);
         $this->addObjectsToObjectStorageByArray($allBookmarks, $groupBookmarks);
     }
     if ($this->bookmarkConfiguration->getShowPublicBookmarks()) {
         $publicBookmarks = $this->bookmarkRepository->findPublicBookmarksByListIdentifier($this->listIdentifier);
         $this->addObjectsToObjectStorageByArray($allBookmarks, $publicBookmarks);
     }
     return $allBookmarks;
 }
Ejemplo n.º 3
0
 /**
  * Returns collection of bookmarks for fe groups for all fe groups given user belongs to and a given list identifier
  *
  * @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $feUser
  * @param string $listIdentifier
  * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Tx_PtExtlist_Domain_Model_Bookmark_Bookmark>
  */
 public function findGroupBookmarksByFeUserAndListIdentifier(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser $feUser, $listIdentifier)
 {
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($listIdentifier, array('message' => 'List identifier must not be empty! 1283117068'));
     $groupBookmarks = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     $feUserGroups = $feUser->getUsergroup();
     foreach ($feUserGroups as $feUserGroup) {
         /* @var $feUserGroup \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup */
         $this->addObjectsToObjectStorageByArray($groupBookmarks, $this->findGroupBookmarksByFeGroupAndListIdentifier($feUserGroup, $listIdentifier));
     }
     return $groupBookmarks;
 }