/** * Returns collection of private bookmarks for given feUser and 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 findPrivateBookmarksByFeUserAndListIdentifier(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser $feUser, $listIdentifier) { $feUserUid = $feUser->getUid(); Tx_PtExtbase_Assertions_Assert::isNotEmptyString($listIdentifier, array('message' => 'List identifier must not be empty! 1283117065')); if ($feUserUid > 0) { $query = $this->createQuery(); $query->setOrderings(array('name' => 'ASC')); $query->matching($query->logicalAnd($query->logicalAnd($query->equals('feUser', $feUserUid), $query->equals('listId', $listIdentifier)), $query->equals('type', Tx_PtExtlist_Domain_Model_Bookmark_Bookmark::PTEXTLIST_BOOKMARK_PRIVATE))); $result = $query->execute(); return $result; } else { return NULL; } }
/** * Returns TRUE only if a FrontendUser is currently logged in. Use argument * to return TRUE only if the FrontendUser logged in must be that specific user. * * @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $frontendUser * @return boolean * @api */ public function assertFrontendUserLoggedIn(FrontendUser $frontendUser = NULL) { $currentFrontendUser = $this->getCurrentFrontendUser(); if (FALSE === $currentFrontendUser instanceof \TYPO3\CMS\Extbase\Domain\Model\FrontendUser) { return FALSE; } if (TRUE === $frontendUser instanceof \TYPO3\CMS\Extbase\Domain\Model\FrontendUser && TRUE === $currentFrontendUser instanceof \TYPO3\CMS\Extbase\Domain\Model\FrontendUser) { if ($currentFrontendUser->getUid() === $frontendUser->getUid()) { return TRUE; } else { return FALSE; } } return (bool) (TRUE === is_object($currentFrontendUser)); }
/** * Find all of the lists not subscribed to by the given user. * * @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $user * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface */ public function findAllNotSubscribedToBy(FrontendUser $user) { $q = $this->createQuery(); $q->matching($q->logicalNot($q->contains('feUsers', [$user->getUid()]))); return $q->execute(); }
/** * Check if FE Session exists * * @param FrontendUser $user * @return bool */ public static function checkFrontendSessionToUser(FrontendUser $user) { $select = 'ses_id'; $from = 'fe_sessions'; $where = 'ses_userid = ' . intval($user->getUid()); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); if (!empty($row['ses_id'])) { return TRUE; } return FALSE; }
/** * Returns TRUE only if a FrontendUser is currently logged in. Use argument * to return TRUE only if the FrontendUser logged in must be that specific user. * * @param FrontendUser $frontendUser * @return boolean * @api */ public function assertFrontendUserLoggedIn(FrontendUser $frontendUser = null) { $currentFrontendUser = $this->getCurrentFrontendUser(); if (false === $currentFrontendUser instanceof FrontendUser) { return false; } if (true === $frontendUser instanceof FrontendUser && true === $currentFrontendUser instanceof FrontendUser) { if ($currentFrontendUser->getUid() === $frontendUser->getUid()) { return true; } else { return false; } } return (bool) (true === is_object($currentFrontendUser)); }