TYPO3 10:未登录后端时禁用页面 [英] TYPO3 10: Disable page when not logged into backend

查看:28
本文介绍了TYPO3 10:未登录后端时禁用页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 TYPO3 10 中有一种方法可以为未登录后端的任何人禁用页面.在 Typo3 10 之前,我相信这样的事情是有效的:

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]

但在 Typo3 10 中,由于 TSFE 数组的变化,这不再起作用.

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

推荐答案

从 9.5.16/10.4.1 开始,您可以使用 [backend.user.isLoggedIn][backend.user.isAdmin] (TSref) 用于检查 BE 用户属性.

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

也许这是隐藏"的更好方法通过设置 HTTP 身份验证来阻止不受欢迎的访问者的页面...

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

更新:

测试了两种变体.两个条件变体在 TYPO3 v10.4.17/10.4.19 中匹配:

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]

注意:要完成这项工作,您的 FE 和 BE 必须能够共享他们的会话 cookie.这意味着,两者都必须使用 相同 域(或适当配置的 cookie 域)调用.注意多域实例和带有/不带有www"的变体(www.example.com != example.com)

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)

这篇关于TYPO3 10:未登录后端时禁用页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆