portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r544627 - in /portals/jetspeed-1/trunk: src/java/org/apache/jetspeed/modules/parameters/MyPagesListBox.java src/java/org/apache/jetspeed/util/PortletUtils.java webapp/WEB-INF/conf/JetspeedResources.properties
Date Tue, 05 Jun 2007 20:48:08 GMT
Author: taylor
Date: Tue Jun  5 13:48:07 2007
New Revision: 544627

URL: http://svn.apache.org/viewvc?view=rev&rev=544627
Log:
https://issues.apache.org/jira/browse/JS1-566

Modified:
    portals/jetspeed-1/trunk/src/java/org/apache/jetspeed/modules/parameters/MyPagesListBox.java
    portals/jetspeed-1/trunk/src/java/org/apache/jetspeed/util/PortletUtils.java
    portals/jetspeed-1/trunk/webapp/WEB-INF/conf/JetspeedResources.properties

Modified: portals/jetspeed-1/trunk/src/java/org/apache/jetspeed/modules/parameters/MyPagesListBox.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-1/trunk/src/java/org/apache/jetspeed/modules/parameters/MyPagesListBox.java?view=diff&rev=544627&r1=544626&r2=544627
==============================================================================
--- portals/jetspeed-1/trunk/src/java/org/apache/jetspeed/modules/parameters/MyPagesListBox.java
(original)
+++ portals/jetspeed-1/trunk/src/java/org/apache/jetspeed/modules/parameters/MyPagesListBox.java
Tue Jun  5 13:48:07 2007
@@ -27,6 +27,7 @@
 import org.apache.jetspeed.services.Profiler;
 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
 import org.apache.jetspeed.services.logging.JetspeedLogger;
+import org.apache.jetspeed.services.resources.JetspeedResources;
 import org.apache.jetspeed.services.rundata.JetspeedRunData;
 import org.apache.jetspeed.util.PortletUtils;
 import org.apache.jetspeed.modules.actions.portlets.PsmlManagerAction;
@@ -71,35 +72,28 @@
             {            
                 // Initialize the query locator
                 QueryLocator ql = new QueryLocator(QueryLocator.QUERY_USER);
-
                 JetspeedRunData jdata = (JetspeedRunData) rundata;
                 ql.setUser(jdata.getJetspeedUser());
                 //ql.setMediaType(jdata.getCapability().getPreferredMediaType());
-                entries = new Hashtable();
-                Iterator i = Profiler.query(ql);
-                while (i.hasNext())
+                entries = new Hashtable();                
+                queryProfiles(jdata, entries, ql);
+                
+                // 2007-06-04: https://issues.apache.org/jira/browse/JS1-566
+                boolean showRolePages = JetspeedResources.getBoolean( "mypages.show.role.pages"
);
+                boolean showGroupPages = JetspeedResources.getBoolean( "mypages.show.group.pages"
);
+                if (showRolePages)
                 {
-                    Profile profile = (Profile) i.next();
-
-                    String mediaType = profile.getMediaType();
-                    if (mediaType != null && mediaType.equals(jdata.getCapability().getPreferredMediaType()))
-                    {
-                        if (PortletUtils.canAccessProfile(rundata, profile))
-                        {
-                            if (logger.isDebugEnabled())
-                            {
-                                logger.debug("MyPagesListBox: refreshing user profile list:
" + profile.getPath());
-                            }
-                            String title = profile.getName();
-                            if (profile.getRootSet() != null && profile.getRootSet().getTitle()
!= null)
-                            {
-                                title = profile.getRootSet().getTitle();
-                            }
-                            entries.put(profile, title);                
-                        }
-                    }
+                    QueryLocator qlRoles = new QueryLocator(QueryLocator.QUERY_ROLE);
+                    qlRoles.setUser(jdata.getJetspeedUser());
+                    queryProfiles(jdata, entries, qlRoles);                    
                 }
-
+                if (showGroupPages)
+                {
+                    QueryLocator qlGroups = new QueryLocator(QueryLocator.QUERY_GROUP);
+                    qlGroups.setUser(jdata.getJetspeedUser());
+                    queryProfiles(jdata, entries, qlGroups);                            
           
+                } 
+                               
                 rundata.getUser().setTemp(PsmlManagerAction.CACHED_PSML, entries);
             }
 
@@ -112,4 +106,31 @@
 
     }
 
+    private void queryProfiles(JetspeedRunData jdata, Map entries, QueryLocator ql)
+    {
+        Iterator i = Profiler.query(ql);
+        while (i.hasNext())
+        {
+            Profile profile = (Profile) i.next();
+
+            String mediaType = profile.getMediaType();
+            if (mediaType != null && mediaType.equals(jdata.getCapability().getPreferredMediaType()))
+            {
+                if (PortletUtils.canAccessProfile(jdata, profile))
+                {
+                    if (logger.isDebugEnabled())
+                    {
+                        logger.debug("MyPagesListBox: refreshing user profile list: " + profile.getPath());
+                    }
+                    String title = profile.getName();
+                    if (profile.getRootSet() != null && profile.getRootSet().getTitle()
!= null)
+                    {
+                        title = profile.getRootSet().getTitle();
+                    }
+                    entries.put(profile, title);                
+                }
+            }
+        }
+       
+    }
 }

Modified: portals/jetspeed-1/trunk/src/java/org/apache/jetspeed/util/PortletUtils.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-1/trunk/src/java/org/apache/jetspeed/util/PortletUtils.java?view=diff&rev=544627&r1=544626&r2=544627
==============================================================================
--- portals/jetspeed-1/trunk/src/java/org/apache/jetspeed/util/PortletUtils.java (original)
+++ portals/jetspeed-1/trunk/src/java/org/apache/jetspeed/util/PortletUtils.java Tue Jun 
5 13:48:07 2007
@@ -93,7 +93,7 @@
 
             result = JetspeedSecurity.checkPermission((JetspeedUser) rundata.getUser(), 
                                                       portalResource, 
-                                                      JetspeedSecurity.PERMISSION_CUSTOMIZE);
+                                                      JetspeedSecurity.PERMISSION_VIEW);
         }
 
         return result;

Modified: portals/jetspeed-1/trunk/webapp/WEB-INF/conf/JetspeedResources.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-1/trunk/webapp/WEB-INF/conf/JetspeedResources.properties?view=diff&rev=544627&r1=544626&r2=544627
==============================================================================
--- portals/jetspeed-1/trunk/webapp/WEB-INF/conf/JetspeedResources.properties (original)
+++ portals/jetspeed-1/trunk/webapp/WEB-INF/conf/JetspeedResources.properties Tue Jun  5 13:48:07
2007
@@ -753,3 +753,9 @@
 # Transformer Service                   #
 #########################################
 services.Transformer.classname = org.apache.jetspeed.services.transformer.JetspeedTransformerService
+
+#########################################
+# My Pages configuration                #
+#########################################
+mypages.show.role.pages = true
+mypages.show.group.pages = true



---------------------------------------------------------------------
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