Right now, this idea doesn't strike me as something that should be in
the core. But I may be wrong. I will note the issue for future
consideration, since I always like to reconsider things.
The reasons it's not appealing to me :
1. It came from a specific assumption about the existing tag. Reading
javadoc for the existing tag would have clarified it's behavior in 10
seconds.
2. It would seem best to me to keep 2 ideas separate: is-user-logged-
in versus does-user-have-role... For example, the most legible syntax
for these operations might resemble:
<w:show ifRole="..." >...
<w:show ifRoleNot="..." >...
<w:showIf loggedIn="true">...
<w:showIf loggedIn="false">...
This would keep each tag simple, clear, and legible.
3. The implementation of a tag for is-user-logged-in would be really
simple to implement. The core of its implementation would be something
like:
@Override protected String getEmittedText(String aOriginalBody) {
Principal user = getRequest().getUserPrincipal();
boolean isLoggedIn = (user != null);
return isLoggedIn == isLoginDesired();
}
This is simple. It's easy to build this, especially since the source
code of the ShowForRole tag is already available.
http://www.web4j.com/web4j/javadoc/src-html/hirondelle/web4j/ui/tag/ShowForRole.html#line.42
4. With a minimal tool like web4j, I need to always ask if any
proposed feature is really a compelling improvement or not. Right now,
this doesn't seem so compelling.
- John