portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r771611 - /portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/UserAttributeResolver.java
Date Tue, 05 May 2009 07:46:33 GMT
Author: taylor
Date: Tue May  5 07:46:31 2009
New Revision: 771611

URL: http://svn.apache.org/viewvc?rev=771611&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-513
I didn't use the patch but instead wrote a simpler implementation more easily supported by
new security model

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/UserAttributeResolver.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/UserAttributeResolver.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/UserAttributeResolver.java?rev=771611&r1=771610&r2=771611&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/UserAttributeResolver.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/UserAttributeResolver.java
Tue May  5 07:46:31 2009
@@ -23,6 +23,8 @@
 import org.apache.jetspeed.profiler.rules.RuleCriterion;
 import org.apache.jetspeed.profiler.rules.RuleCriterionResolver;
 import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.UserSubjectPrincipal;
 
 /**
  * Looks in the Portlet API User Attributes for given named attribute 
@@ -41,16 +43,19 @@
      */    
     public String resolve(RequestContext context, RuleCriterion criterion)
     {
-        Object object = context.getRequest().getAttribute(PortletRequest.USER_INFO);
-        if (object != null && object instanceof Map)
+        if (context.getUserPrincipal() instanceof User)
         {
-            Map map = (Map)object;
-            String attribute = (String)map.get(criterion.getName());
-            if (attribute != null)
+            User user = (User)context.getUserPrincipal();
+            if (user != null)
             {
-                return attribute;
+                Map<String, String> map = user.getInfoMap();
+                String attribute = (String)map.get(criterion.getName());
+                if (attribute != null)
+                {
+                    return attribute;
+                }
+                return criterion.getValue();
             }
-            return criterion.getValue();
         }
         return null;
      }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message