geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r159089 - geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Date Sat, 26 Mar 2005 02:30:50 GMT
Author: jgenender
Date: Fri Mar 25 18:30:48 2005
New Revision: 159089

URL: http://svn.apache.org/viewcvs?view=rev&rev=159089
Log:
Combined WebResourcePermissions with the same URLPattern for unchecked permissions

Modified:
    geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java

Modified: geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?view=diff&r1=159088&r2=159089
==============================================================================
--- geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Fri Mar 25 18:30:48 2005
@@ -831,6 +831,8 @@
 
     private void buildSpecSecurityConfig(WebAppType webApp, GBeanData webModuleData, Set
securityRoles) {
         Map uncheckedPatterns = new HashMap();
+        Map uncheckedResourcePatterns = new HashMap();
+        Map uncheckedUserPatterns = new HashMap();
         Map excludedPatterns = new HashMap();
         Map rolesPatterns = new HashMap();
         Set allSet = new HashSet();   // == allMap.values()
@@ -948,7 +950,7 @@
             String name = pattern.getQualifiedPattern(allSet);
             String actions = pattern.getMethods();
 
-            uncheckedPermissions.add(new WebResourcePermission(name, actions));
+            addOrUpdatePattern(uncheckedResourcePatterns, name, actions);
         }
 
         iter = rolesPatterns.keySet().iterator();
@@ -957,7 +959,7 @@
             String name = pattern.getQualifiedPattern(allSet);
             String actions = pattern.getMethodsWithTransport();
 
-            uncheckedPermissions.add(new WebUserDataPermission(name, actions));
+            addOrUpdatePattern(uncheckedUserPatterns, name, actions);
         }
 
         iter = uncheckedPatterns.keySet().iterator();
@@ -966,7 +968,7 @@
             String name = pattern.getQualifiedPattern(allSet);
             String actions = pattern.getMethodsWithTransport();
 
-            uncheckedPermissions.add(new WebUserDataPermission(name, actions));
+            addOrUpdatePattern(uncheckedUserPatterns, name, actions);
         }
 
         /**
@@ -988,8 +990,8 @@
                 continue;
             }
 
-            uncheckedPermissions.add(new WebResourcePermission(name, actions));
-            uncheckedPermissions.add(new WebUserDataPermission(name, actions));
+            addOrUpdatePattern(uncheckedResourcePatterns, name, actions);
+            addOrUpdatePattern(uncheckedUserPatterns, name, actions);
         }
 
         URLPattern pattern = new URLPattern("/");
@@ -997,13 +999,40 @@
             String name = pattern.getQualifiedPattern(allSet);
             String actions = pattern.getComplementedMethods();
 
+            addOrUpdatePattern(uncheckedResourcePatterns, name, actions);
+            addOrUpdatePattern(uncheckedUserPatterns, name, actions);
+        }
+
+        //Create the uncheckedPermissions for WebResourcePermissions
+        iter = uncheckedResourcePatterns.keySet().iterator();
+        while (iter.hasNext()) {
+            String name = (String)iter.next();
+            String actions = (String)uncheckedResourcePatterns.get(name);
+
             uncheckedPermissions.add(new WebResourcePermission(name, actions));
+        }
+        //Create the uncheckedPermissions for WebUserDataPermissions
+        iter = uncheckedUserPatterns.keySet().iterator();
+        while (iter.hasNext()) {
+            String name = (String)iter.next();
+            String actions = (String)uncheckedUserPatterns.get(name);
+
             uncheckedPermissions.add(new WebUserDataPermission(name, actions));
         }
 
         webModuleData.setAttribute("excludedPermissions", excludedPermissions);
         webModuleData.setAttribute("uncheckedPermissions", uncheckedPermissions);
         webModuleData.setAttribute("rolePermissions", rolePermissions);
+    }
+
+    private void addOrUpdatePattern(Map patternMap, String name, String actions){
+        String oldActions = (String)patternMap.get(name);
+        if (oldActions != null){
+            patternMap.put(name,actions + "," + oldActions);
+            return;
+        }
+
+        patternMap.put(name, actions);
     }
 
     private static Set collectRoleNames(WebAppType webApp) {



Mime
View raw message