geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r540258 - in /geronimo/server/trunk/applications/console/geronimo-console-standard/src/main: java/org/apache/geronimo/console/securitymanager/ webapp/WEB-INF/view/securityrealmmanager/se/groups/ webapp/WEB-INF/view/securityrealmmanager/se/u...
Date Mon, 21 May 2007 20:01:38 GMT
Author: dwoods
Date: Mon May 21 13:01:37 2007
New Revision: 540258

URL: http://svn.apache.org/viewvc?view=rev&rev=540258
Log:
GERONIMO-1767 Require created Console Realm users to belong to a group.  Also changed the
user/group Details link to Edit, since the link let the user/group to be modified.  Erik,
thanks for the patch to require a group for new users.

Modified:
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/groups/maximized.jsp
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/users/addmaximized.jsp
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/users/maximized.jsp

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java?view=diff&rev=540258&r1=540257&r2=540258
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/securitymanager/SEUsersPortlet.java
Mon May 21 13:01:37 2007
@@ -56,25 +56,35 @@
                 Hashtable userInfo = new Hashtable();
                 for (int i = 0; i < users.length; i++) {
                     String currentUser = users[i];
-                    userInfo.put(currentUser, SERealmUserHelper
-                            .getPassword(currentUser.toString()));
+                    // We really shouldn't be attaching everyone's password as portlet data!!!
+                    // And the current Portlet doesn't use it, so why send it....
+                    // userInfo.put(currentUser, SERealmUserHelper.getPassword(currentUser.toString()));
+                    userInfo.put(currentUser, currentUser.toString());
                 }
 
                 String currAction = renderRequest.getParameter("currAction");
-                renderRequest.setAttribute("message", renderRequest
-                        .getParameter("message"));
+                renderRequest.setAttribute("message", renderRequest.getParameter("message"));
 
-                if ("new".equals(currAction) || "edit".equals(currAction)) {
-                    if (currAction.equals("edit")) {
-                        String user = renderRequest.getParameter("user");
-                        renderRequest.setAttribute("userID", user);
-                        renderRequest.setAttribute("password",
-                                SERealmUserHelper.getPassword(user));
+                if ("new".equals(currAction)) {
+                    String[] groups = SERealmGroupHelper.getGroups();
+                    Hashtable groupsInfo = new Hashtable();
+                    for (int i = 0; i < groups.length; i++) {
+                        String currentGroup = groups[i];
+                        groupsInfo.put(currentGroup, SERealmGroupHelper.getUsers(currentGroup));
                     }
+                    renderRequest.setAttribute("groupsInfo", groupsInfo);
+                    addMaximizedView.include(renderRequest, renderResponse);
+                } else if ("edit".equals(currAction)) {
+                    String user = renderRequest.getParameter("user");
+                    renderRequest.setAttribute("userID", user);
+                    // We really shouldn't be sending the user's password as portlet data!!!
+                    // And the current Portlet doesn't use it, so why send it....
+                    //renderRequest.setAttribute("password", SERealmUserHelper.getPassword(user));
+                    // Current Portlet doesn't use groupsInfo, so why send it 
+                    //renderRequest.setAttribute("groupsInfo", groupsInfo);
                     addMaximizedView.include(renderRequest, renderResponse);
                 } else {
-                    if (WindowState.NORMAL.equals(renderRequest
-                            .getWindowState())) {
+                    if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
                         renderRequest.setAttribute("userInfo", userInfo);
                         normalView.include(renderRequest, renderResponse);
                     } else {
@@ -117,19 +127,25 @@
         }
         String user = actionRequest.getParameter("userId");
         String password = actionRequest.getParameter("password");
+        String group = actionRequest.getParameter("group");
 
         try {
             if ("delete".equals(action)) {
-                SERealmUserHelper.deleteUser(user);
-                String[] groups = SERealmGroupHelper.getGroups();
-                for (int i = 0; i < groups.length; i++) {
-                    String currentGroup = groups[i];
-                    if (SERealmGroupHelper.isGroupMember(currentGroup, user)) {
-                        Collection list = SERealmGroupHelper.getUsers(currentGroup);
-                        list.remove(user);
-                        String[] groupUsers = (String[]) list.toArray(new String[0]);
-                        SERealmGroupHelper.updateGroup(currentGroup, groupUsers);
+                try {
+                    String[] groups = SERealmGroupHelper.getGroups();
+                    for (int i = 0; i < groups.length; i++) {
+                        String currentGroup = groups[i];
+                        if (SERealmGroupHelper.isGroupMember(currentGroup, user)) {
+                            Collection list = SERealmGroupHelper.getUsers(currentGroup);
+                            list.remove(user);
+                            String[] groupUsers = (String[]) list.toArray(new String[0]);
+                            SERealmGroupHelper.updateGroup(currentGroup, groupUsers);
+                        }
                     }
+                    SERealmUserHelper.deleteUser(user);
+                } catch (Exception e) {
+                    actionResponse.setRenderParameter("message",
+                            "ERROR: Error in SEUsersPortlet while deleting user "+user+".
Cause: "+e.getMessage());
                 }
             } else if ("update".equals(action)) {
                 if(password != null && !password.equals("")) {
@@ -139,9 +155,15 @@
             } else if ("add".equals(action)) {
                 try {
                     SERealmUserHelper.addUser(user, password);
+                    if ((group != null) && (!group.equals(""))) {
+                        Collection list = SERealmGroupHelper.getUsers(group);
+                        list.add(user);
+                        String[] groupUsers = (String[]) list.toArray(new String[0]);
+                        SERealmGroupHelper.updateGroup(group, groupUsers);
+                    }
                 } catch (Exception e) {
                     actionResponse.setRenderParameter("message",
-                            "ERROR: Error in SEUsersPortlet while adding user "+user+". Cause:
"+e.getMessage());
+                            "ERROR: Error in SEUsersPortlet while adding user "+user+" to
group "+group+". Cause: "+e.getMessage());
                 }
             } else if ("new".equals(action)) {
                 currAction = "new";

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/groups/maximized.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/groups/maximized.jsp?view=diff&rev=540258&r1=540257&r2=540258
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/groups/maximized.jsp
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/groups/maximized.jsp
Mon May 21 13:01:37 2007
@@ -40,7 +40,7 @@
         <tr>
             <td class="${backgroundClass}"> ${group.key} </td>
             <td class="${backgroundClass}">
-            <a href="<portlet:actionURL portletMode="view"><portlet:param name="action"
value="edit"/><portlet:param name="group" value="${group.key}"/></portlet:actionURL>">Details</a>
+            <a href="<portlet:actionURL portletMode="view"><portlet:param name="action"
value="edit"/><portlet:param name="group" value="${group.key}"/></portlet:actionURL>">Edit</a>
             &nbsp;
             <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>

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/users/addmaximized.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/users/addmaximized.jsp?view=diff&rev=540258&r1=540257&r2=540258
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/users/addmaximized.jsp
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/users/addmaximized.jsp
Mon May 21 13:01:37 2007
@@ -72,6 +72,22 @@
             
         </td>
     </tr>   
+    <c:choose>
+      <c:when test="${add}">
+        <tr>
+          <td width="200">Group</td>
+          <td>
+            <select name="group">
+              <c:forEach var="groups" items="${groupsInfo}">
+                <option value="${groups.key}">${groups.key}</option>
+              </c:forEach>
+            </select>
+          </td>
+        </tr>
+      </c:when>
+      <c:otherwise>
+      </c:otherwise>
+    </c:choose>
     <tr>
         <td width="200">Password</td>
         <td><input type="password" name="password" value=""></td>

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/users/maximized.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/users/maximized.jsp?view=diff&rev=540258&r1=540257&r2=540258
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/users/maximized.jsp
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/securityrealmmanager/se/users/maximized.jsp
Mon May 21 13:01:37 2007
@@ -66,7 +66,7 @@
         <tr>
             <td class="${backgroundClass}"> ${user.key} </td>
             <td class="${backgroundClass}">
-            <a href = "<portlet:actionURL portletMode="view"><portlet:param name="action"
value="edit"/><portlet:param name="userId" value="${user.key}"/></portlet:actionURL>">Details</a>
+            <a href = "<portlet:actionURL portletMode="view"><portlet:param name="action"
value="edit"/><portlet:param name="userId" value="${user.key}"/></portlet:actionURL>">Edit</a>
             &nbsp;
             <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>



Mime
View raw message