Skip to content

Commit

Permalink
[WIP] queryBuilder restricionts
Browse files Browse the repository at this point in the history
  • Loading branch information
achimfritz committed Dec 4, 2024
1 parent 2c785b4 commit 304c37c
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions Classes/Domain/Factory/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,10 @@ public function __construct(Context $context)
protected function getQueryBuilder(): QueryBuilder
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content');
if ($this->getServerRequest() instanceof ServerRequestInterface
&& ApplicationType::fromRequest($this->getServerRequest())->isFrontend()
) {
$queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) {
// do not use FrontendWorkspaceRestriction
$queryBuilder->getRestrictions()
->removeByType(FrontendWorkspaceRestriction::class)
->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, $this->workspaceId));
}
if ($this->workspaceId > 0) {
$queryBuilder->getRestrictions()->removeByType(HiddenRestriction::class);
}
} else {
$queryBuilder->getRestrictions()
->removeAll()
->add(GeneralUtility::makeInstance(DeletedRestriction::class))
->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, $this->workspaceId));
}
$queryBuilder->getRestrictions()
->removeAll()
->add(GeneralUtility::makeInstance(DeletedRestriction::class))
->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, $this->workspaceId));
return $queryBuilder;
}

Expand Down

0 comments on commit 304c37c

Please sign in to comment.