[TYPO3-mvc] flashMessage only visible for BE users

Stephan Schuler Stephan.Schuler at netlogix.de
Thu Jan 22 12:13:21 CET 2015


Hey there.

I suggest to *not* do that in Fluid. It will cause some unexpected trouble.

Flash message content is just data pushed to the "flash messages store" (don't know the exact name) which lives in the users session.

Not every page is capable of displaying flash messages. Think about e.g. a shopping cart checkout page displaying price details right before hitting "yes, go to paypal and pay". There you usually don't want the user to be disturbed by "login successful" or something. Just as an example.
Other pages are mostly cached like some details view but contain plugins somewhere that can create flash messages like e.g. a small login form at the top right.
Other pages cannot display any HTML data so they cannot display flash messages, too. Think about RESTfull endpoints for AJAX stuff. A "add to basket" RESTfull service can clearly create a "product not found" message or "availability: not available".

Therefore the concept of flash messages is a two steps thing:
1: Push the flash message content to the session storage.
2: Draw every flash message of that session storage.

Skipping the flash message view helper in one place doesn't mean the corresponding flash messages aren't drawn. It just means they are saved for the next request as long as there is no flash message view helper on the current page.

So you cannot skip the flash message view helper but you need to iterate over each and every flash message and decide per message if it's to be rendered or not right inside of the flash message view helper. Once the iteration is over, the message is treated as rendered, no matter if it's really displayed or not.

And that's the ugly part. Pushing it to rendering, hide while rendering and treat it as rendered feels strange.

The best way to do such a thing is to determine right in PHP (right where the flash message is handed over to the flash messages service) if the user is meant to get that message.
Dropping it during rendering is just the wrong way.

So your question is wrong. You clearly don't want to "add flash messages that are only visible for BE users" but you want to "only add flash messages for BE users".

Regards,


Stephan Schuler
Web-Entwickler | netlogix Media

Telefon: +49 (911) 539909 - 0
E-Mail: Stephan.Schuler at netlogix.de
Web: media.netlogix.de




netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Neuwieder Straße 10 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de | Web: http://www.netlogix.de

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt



-----Ursprüngliche Nachricht-----
Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org [mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von Jonas Eberle
Gesendet: Mittwoch, 21. Januar 2015 17:26
An: TYPO3 v4 MVC project
Betreff: Re: [TYPO3-mvc] flashMessage only visible for BE users

Hi Muriel,

check out the VHS ViewHelpers. They allow to check for a logged-in backend user from within a Fluid template:
https://fluidtypo3.org/viewhelpers/vhs/master/Security/AllowViewHelper.html

If you need to have the functionality in PHP, you can check $GLOBALS['BE_USER']->user for user data.

Regards,
Jonas

Am 12.01.2015 um 15:04 schrieb Muriel le Pair:
> Hi,
>
> I would like to add some warnings that should only be visible for BE
> users.
>
> Is it possible to add a flashMessage that is only visible to BE users?
> If not how do I check if a BE users is loged in?
>
> --
> kind regards,
>
> Muriel le Pair
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4m
> vc


--
Neu: welcome.region-stuttgart.de
Neu: ladenbackofen.de
Neu: beltamor.de
--------------------------------
d-mind bei Facebook:
http://www.facebook.com/werbeagentur.internetagentur.stuttgart
--------------------------------
d-mind
Fuchs/Weiß/Strobel GbR
Mörikestraße 69
70199 Stuttgart

Tel.: +49 711 280481-1 (Durchwahl: -18)
Fax:  +49 711 280481-3
Inhaber: Jens Fuchs, Michael Weiß, Jens Strobel www.d-mind.de

_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc


More information about the TYPO3-project-typo3v4mvc mailing list