Author: bdaw
Date: 2007-03-19 05:36:28 -0400 (Mon, 19 Mar 2007)
New Revision: 6739
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
Log:
- make UserPortlet little less fragile
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-03-19
08:44:14 UTC (rev 6738)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-03-19
09:36:28 UTC (rev 6739)
@@ -194,7 +194,7 @@
resp.setContentType("text/html");
PrintWriter writer = resp.getWriter();
- if ((req.getUser() != null) && (!((getProperty(req.getUser(),
User.INFO_USER_ENABLED)).equals("true"))))
+ if ((req.getUser() != null) && (!(isEnabled(req.getUser()))))
{
req.getPortletSession().invalidate();
PortletRequestDispatcher rd =
getPortletContext().getRequestDispatcher("/WEB-INF/jsp/user/login.jsp");
@@ -1277,6 +1277,19 @@
return null;
}
+ private boolean isEnabled(User user)
+ {
+ Object enabled = getProperty(user, User.INFO_USER_ENABLED);
+
+ if (enabled == null || !(enabled instanceof Boolean))
+ {
+ return false;
+ }
+
+ return enabled.equals("true");
+
+ }
+
/*
Show replies by date