crsdahl
crsdahl

Reputation: 595

TYPO3 10: Disable page when not logged into backend

In TYPO3 10 is there a way to disable a page for anyone not logged in to the backend. Prior to Typo3 10, I believe something like this worked:

[getTSFE() && getTSFE().isBackendUserLoggedIn() == false]
  page = PAGE
  page.10 = TEXT
  page.10.value = Page disabled
[GLOBAL]

But in Typo3 10 this does not work any more because of changes in the TSFE Array.

Upvotes: 0

Views: 265

Answers (1)

Julian Hofmann
Julian Hofmann

Reputation: 2577

Since 9.5.16/10.4.1, you could use [backend.user.isLoggedIn] or [backend.user.isAdmin] (TSref) for checking BE user properties.

Maybe it would be a better approach to "hide" the page for unwanted visitors by setting an HTTP auth...


Update:

Tested both variants. Both condition variants are matching in an TYPO3 v10.4.17/10.4.19:

page.200 = TEXT
[getTSFE() && getTSFE().isBackendUserLoggedIn() == true]
    page.200.value = BE-User is logged in.
[getTSFE() && getTSFE().isBackendUserLoggedIn() == false]
    page.200.value = BE-User is NOT logged in.
[global]

page.250 = TEXT
page.250.value = <hr />

page.300 = TEXT
page.300.value = BE-User is NOT logged in.
[backend.user.isLoggedIn]
    page.300.value = BE-User is logged in.
[global]

Notice: To get this work, your FE and BE must be able to share their session cookie. This means, both must be called with same domain (or appropriately configured cookie domain). Be aware with multi-domain instance and the variants with/without "www" (www.example.com != example.com)

Upvotes: 2

Related Questions