geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r1025608 - in /geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main: java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java webapp/WEB-INF/themes/navigation.jsp
Date Wed, 20 Oct 2010 14:58:31 GMT
Author: genspring
Date: Wed Oct 20 14:58:30 2010
New Revision: 1025608

URL: http://svn.apache.org/viewvc?rev=1025608&view=rev
Log:
GERONIMO-5612  Filter no permission functions for built-in user "monitor"

Modified:
    geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
    geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp

Modified: geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java?rev=1025608&r1=1025607&r2=1025608&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
(original)
+++ geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
Wed Oct 20 14:58:30 2010
@@ -16,12 +16,15 @@
  */
 package org.apache.geronimo.console.navigation;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.ResourceBundle;
 import java.util.TreeMap;
+import javax.servlet.http.HttpServletRequest;
 
 import org.apache.geronimo.pluto.impl.PageConfig;
 import org.slf4j.Logger;
@@ -52,6 +55,50 @@ public class NavigationJsonGenerator {
     private static  Map<String, Map<String, TreeNode>> navigationTrees=new HashMap<String,
Map<String, TreeNode>>();
     
     public static final String ALL = "all";
+    
+    private final static List<String> monitorRolePermitPages = Arrays.asList(
+            "0/Welcome",
+            "1-1/Server/Information",
+            "1-2/Server/Java System Info",
+            "1-6/Server/Thread Pools",
+            "1-8/Server/Monitoring"
+    ); 
+           
+    private static Map<String, List<String>> rolePagesMap=new HashMap<String,
List<String>>();
+    
+    static {
+        
+        rolePagesMap.put("monitor", monitorRolePermitPages);
+        
+    }
+    
+    public static List<PageConfig> filterPagesByRole(List<PageConfig> pageConfigList,
HttpServletRequest request){
+        
+        List<String> permitPages=null;
+        
+        if(request.isUserInRole("monitor")){
+            
+            permitPages=rolePagesMap.get("monitor"); 
+        }
+        
+        if (permitPages == null) {
+            return pageConfigList;
+        }
+
+        List<PageConfig> filteredPageConfigList = new ArrayList<PageConfig>();
+
+        for (PageConfig pc : pageConfigList) {
+
+            if (permitPages.contains(pc.getName())) {
+
+                filteredPageConfigList.add(pc);
+            }
+        }
+        
+        return filteredPageConfigList;
+        
+    };
+    
       
     private ResourceBundle navigationResourcebundle;
          

Modified: geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp?rev=1025608&r1=1025607&r2=1025608&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp
(original)
+++ geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp
Wed Oct 20 14:58:30 2010
@@ -38,12 +38,18 @@ limitations under the License.
 </c:forEach>
 
 <%
+	
+	List<PageConfig> filteredPageConfigList = NavigationJsonGenerator.filterPagesByRole(pageConfigList,request);
+	    
+
     NavigationJsonGenerator generator = new NavigationJsonGenerator(request.getLocale());
-    String treeJson = generator.generateTreeJSON(pageConfigList, request.getContextPath(),
"/images/ico_doc_16x16.gif", "all", 8);
-    String treeJsonBasic = generator.generateTreeJSON(pageConfigList, request.getContextPath(),
"/images/ico_doc_16x16.gif","basic", 8);
-    String listJson = generator.generateQuickLauncherJSON(pageConfigList, request.getContextPath(),
"/images/ico_doc_16x16.gif", "all");
-    String listJsonBasic = generator.generateQuickLauncherJSON(pageConfigList, request.getContextPath(),
"/images/ico_doc_16x16.gif","basic");
-    boolean isBasicTreeHasValidItem=generator.isTreeHasValidItem(pageConfigList,"basic");
+
+
+    String treeJson = generator.generateTreeJSON(filteredPageConfigList, request.getContextPath(),
"/images/ico_doc_16x16.gif", "all", 8);
+    String treeJsonBasic = generator.generateTreeJSON(filteredPageConfigList, request.getContextPath(),
"/images/ico_doc_16x16.gif","basic", 8);
+    String listJson = generator.generateQuickLauncherJSON(filteredPageConfigList, request.getContextPath(),
"/images/ico_doc_16x16.gif", "all");
+    String listJsonBasic = generator.generateQuickLauncherJSON(filteredPageConfigList, request.getContextPath(),
"/images/ico_doc_16x16.gif","basic");
+    boolean isBasicTreeHasValidItem=generator.isTreeHasValidItem(filteredPageConfigList,"basic");
 
 %>
 



Mime
View raw message