[TYPO3-english] Is using global $BE_USER incorrect?
Nicolas Kuttler
typo3-english at nicolaskuttler.de
Wed Sep 29 10:28:52 CEST 2010
On Tue, Sep 28, 2010 at 08:52:16AM +0200, Bjoern Pedersen wrote:
> > typoscript:
> > [globalVar = TSFE:beUserLogin>0]
> > # do something
> > [global]
> >
> > This condition is only true for BE admin users, which is rather useless
> > in my case.
> >
> > From within the constructor of a FE extension (in the pi1/mainfile.php):
> >
> > function __construct() {
> > global $BE_USER;
> > global $TSFE;
> > $this->log( is_object( $BE_USER ) ); // only true for BE admins
> > $this->log( $TSFE->beUserLogin ); // only true for BE admins
> > }
> >
> Looking at the code, it should be working. There are only the following
> checks which could cause a failure:
Yes, my thoughts exactly. This should be trivial.
> lockIP is set and not fullfilled.
Was set to 2 or 4 for FE/BE, setting both to 0 didn't change the
behaviour.
> adminOnly is set
Set to 0.
> lockSSL is set and not fulfilled. (If you have set lockSSL for the
> backend, then you will only succeed with this test, if you access the FE
> trough SSL as well.)
Is set to 0.
Anyway, I have filed a bug, but don't have too much hope tbh.
http://bugs.typo3.org/view.php?id=15827
In the meantime I'll try to make something like work
function auth_check() {
$user = t3lib_div::makeInstance('t3lib_beUserAuth');
$user->start();
if ( $user->user['uid'] > 0 )
return true;
return false;
}
--
Jean-Nicolas Kuttler
Web : www.nkuttler.de | www.nicolaskuttler.de
Mail : office at nicolaskuttler.de
Tel. : +49 681 3838138
MSN : msn at nicolaskuttler.de
skype : nkuttler
More information about the TYPO3-english
mailing list