geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r356058 - in /geronimo/trunk/applications: console-core/src/java/org/apache/geronimo/console/core/security/ console-standard/src/java/org/apache/geronimo/console/securitymanager/ console-standard/src/webapp/WEB-INF/view/securityrealmmanager...
Date Sun, 11 Dec 2005 23:03:16 GMT
Author: ammulder
Date: Sun Dec 11 15:03:11 2005
New Revision: 356058

URL: http://svn.apache.org/viewcvs?rev=356058&view=rev
Log:
Applied patch from GERONIMO-1250

Modified:
    geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/core/security/PropertiesLoginModuleManager.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEGroupsPortlet.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/securityrealmmanager/se/groups/maximized.jsp
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/securityrealmmanager/se/users/maximized.jsp

Modified: geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/core/security/PropertiesLoginModuleManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/core/security/PropertiesLoginModuleManager.java?rev=356058&r1=356057&r2=356058&view=diff
==============================================================================
--- geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/core/security/PropertiesLoginModuleManager.java
(original)
+++ geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/core/security/PropertiesLoginModuleManager.java
Sun Dec 11 15:03:11 2005
@@ -17,6 +17,13 @@
 
 package org.apache.geronimo.console.core.security;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.UnknownServiceException;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Hashtable;
@@ -102,8 +109,7 @@
             refreshUsers();
             users.setProperty((String) properties.get("UserName"),
                     (String) properties.get("Password"));
-            users.store(serverInfo.resolve(getUsersURI()).toURL()
-                    .openConnection().getOutputStream(), null);
+            store(users, serverInfo.resolve(getUsersURI()).toURL());
         } catch (Exception e) {
             throw new GeronimoSecurityException("Cannot add user principal: "
                     + e.getMessage());
@@ -115,8 +121,7 @@
         try {
             refreshUsers();
             users.remove(userPrincipal);
-            users.store(serverInfo.resolve(getUsersURI()).toURL()
-                    .openConnection().getOutputStream(), null);
+            store(users, serverInfo.resolve(getUsersURI()).toURL());
         } catch (Exception e) {
             throw new GeronimoSecurityException("Cannot remove user principal "
                     + userPrincipal + ": " + e.getMessage());
@@ -130,8 +135,7 @@
             refreshUsers();
             users.setProperty((String) properties.get("UserName"),
                     (String) properties.get("Password"));
-            users.store(serverInfo.resolve(getUsersURI()).toURL()
-                    .openConnection().getOutputStream(), null);
+            store(users, serverInfo.resolve(getUsersURI()).toURL());
         } catch (Exception e) {
             throw new GeronimoSecurityException("Cannot add user principal: "
                     + e.getMessage());
@@ -148,8 +152,7 @@
         try {
             groups.setProperty((String) properties.get("GroupName"),
                     (String) properties.get("Members"));
-            groups.store(serverInfo.resolve(getGroupsURI()).toURL()
-                    .openConnection().getOutputStream(), null);
+            store(groups, serverInfo.resolve(getGroupsURI()).toURL());
         } catch (Exception e) {
             throw new GeronimoSecurityException("Cannot add group principal: "
                     + e.getMessage());
@@ -161,8 +164,7 @@
         refreshGroups();
         try {
             groups.remove(groupPrincipal);
-            groups.store(serverInfo.resolve(getGroupsURI()).toURL()
-                    .openConnection().getOutputStream(), null);
+            store(groups, serverInfo.resolve(getGroupsURI()).toURL());
         } catch (Exception e) {
             throw new GeronimoSecurityException(
                     "Cannot remove group principal: " + e.getMessage());
@@ -176,8 +178,7 @@
         try {
             groups.setProperty((String) properties.get("GroupName"),
                     (String) properties.get("Members"));
-            groups.store(serverInfo.resolve(getGroupsURI()).toURL()
-                    .openConnection().getOutputStream(), null);
+            store(groups, serverInfo.resolve(getGroupsURI()).toURL());
         } catch (Exception e) {
             throw new GeronimoSecurityException("Cannot add group principal: "
                     + e.getMessage());
@@ -269,4 +270,24 @@
         return GBEAN_INFO;
     }
 
+    private void store(Properties props, URL url) throws Exception{
+        OutputStream out = null;
+        try {
+            URLConnection con = url.openConnection();
+            con.setDoOutput(true);
+            out = con.getOutputStream();
+        } catch(Exception e){
+            if("file".equalsIgnoreCase(url.getProtocol()) && e instanceof UnknownServiceException)
{
+                out = new FileOutputStream(new File(url.getFile()));
+            } else {
+                throw e;
+            }
+        }
+        props.store(out, null);
+        try {
+            out.close();
+        } catch(IOException ie) {
+            // Ignore
+        }
+    }
 }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEGroupsPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEGroupsPortlet.java?rev=356058&r1=356057&r2=356058&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEGroupsPortlet.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEGroupsPortlet.java
Sun Dec 11 15:03:11 2005
@@ -124,7 +124,7 @@
                     SERealmGroupHelper.addGroup(group, users);
                 } catch (Exception e) {
                     actionResponse.setRenderParameter("message",
-                            "ERROR: Group already exists");
+                            "ERROR: Error in SEGroupsPortlet while adding group "+group+".
Cause:"+e.getMessage());
                 }
             } else if ("new".equals(action)) {
                 currAction = "new";
@@ -136,8 +136,8 @@
                 actionResponse.setRenderParameter("group", group);
             }
         } catch (Exception e) {
-            actionResponse.setRenderParameter("errorMessage",
-                    "Error encountered in DerbyGroupsPortlet: "
+            actionResponse.setRenderParameter("message",
+                    "Error encountered in SEGroupsPortlet. Cause: "
                             + e.getMessage());
         }
     }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java?rev=356058&r1=356057&r2=356058&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java
Sun Dec 11 15:03:11 2005
@@ -123,7 +123,7 @@
                     SERealmUserHelper.addUser(user, password);
                 } catch (Exception e) {
                     actionResponse.setRenderParameter("message",
-                            "ERROR: User already exists");
+                            "ERROR: Error in SEUsersPortlet while adding user "+user+". Cause:
"+e.getMessage());
                 }
             } else if ("new".equals(action)) {
                 currAction = "new";
@@ -135,8 +135,8 @@
                 actionResponse.setRenderParameter("user", user);
             }
         } catch (Exception e) {
-            actionResponse.setRenderParameter("errorMessage",
-                    "Error encountered in DerbyGroupsPortlet: "
+            actionResponse.setRenderParameter("message",
+                    "Error encountered in SEUsersPortlet. Cause: "
                             + e.getMessage());
         }
     }

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/securityrealmmanager/se/groups/maximized.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/securityrealmmanager/se/groups/maximized.jsp?rev=356058&r1=356057&r2=356058&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/securityrealmmanager/se/groups/maximized.jsp
(original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/securityrealmmanager/se/groups/maximized.jsp
Sun Dec 11 15:03:11 2005
@@ -17,7 +17,7 @@
         <input type="hidden" name="group" value="${group.key}">
         <tr>
             <td width="100"><a href="<portlet:actionURL portletMode="view"><portlet:param
name="action" value="edit"/><portlet:param name="group" value="${group.key}"/></portlet:actionURL>">${group.key}</a></td>
-            <td><a href="<portlet:actionURL><portlet:param name="group"
value="${group.key}"/><portlet:param name="action" value="delete"/></portlet:actionURL>"
onclick="return confirm('Confirm Delete?');">Delete</a></td>
+            <td><a href="<portlet:actionURL><portlet:param name="group"
value="${group.key}"/><portlet:param name="action" value="delete"/></portlet:actionURL>"
onclick="return confirm('Confirm Delete group ${group.key}?');">Delete</a></td>
         </tr>
         </form>
     </c:forEach>

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/securityrealmmanager/se/users/maximized.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/securityrealmmanager/se/users/maximized.jsp?rev=356058&r1=356057&r2=356058&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/securityrealmmanager/se/users/maximized.jsp
(original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/securityrealmmanager/se/users/maximized.jsp
Sun Dec 11 15:03:11 2005
@@ -45,7 +45,7 @@
             ${user.key}
             </a>
             </td>
-            <td><a href="<portlet:actionURL><portlet:param name="userId"
value="${user.key}"/><portlet:param name="action" value="delete"/></portlet:actionURL>"
onclick="return confirm('Confirm Delete?');">Delete</a></td>
+            <td><a href="<portlet:actionURL><portlet:param name="userId"
value="${user.key}"/><portlet:param name="action" value="delete"/></portlet:actionURL>"
onclick="return confirm('Confirm Delete user ${user.key}?');">Delete</a></td>
         </tr>
     </c:forEach>
     



Mime
View raw message