You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by at...@apache.org on 2005/12/06 20:49:23 UTC

svn commit: r354525 [1/2] - in /portals/jetspeed-2/trunk: applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/ applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/groups/ applications/j2-admin/src/java/org/apache/jetsp...

Author: ate
Date: Tue Dec  6 11:48:58 2005
New Revision: 354525

URL: http://svn.apache.org/viewcvs?rev=354525&view=rev
Log:
Implementing and fixing
- JS2-21 :Missing Security Feature: Check roles assigned to any group to user belongs
- JS2-337: Error displayed when (successfully) creating user

As for JS2-21 I rewrote/fixed most of the Group portlets, especially with respect to error handling,
I did the same for the Role and User portlets, resulting in JS2-337 getting fixed automatically too :-) 

Added:
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleChooserPortlet.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/roles/role-multi-chooser.vm
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/errors-include.jsp
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/errors-include.vm
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/Administrative/choosers/multiroles.psml
Modified:
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/SecurityResources.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/SecurityUtil.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/groups/GroupBrowser.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/groups/GroupDetails.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleBrowser.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleDetails.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/users/UserBrowser.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/users/UserDetailsPortlet.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/groups/group-details.vm
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/groups/groups-view.vm
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/roles/role-details.vm
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/roles/roles-view.vm
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/users/user-browser.vm
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/users/user-details-edit.jsp
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/users/user-details.jsp

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/SecurityResources.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/SecurityResources.java?rev=354525&r1=354524&r2=354525&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/SecurityResources.java (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/SecurityResources.java Tue Dec  6 11:48:58 2005
@@ -34,10 +34,11 @@
     
     // Message Topics
     public final static String TOPIC_USERS = "users";
+    public final static String TOPIC_USER = "user";
     public final static String TOPIC_GROUPS = "groups";
-    public final static String TOPIC_GROUPS_USERS = "groups.users";
+    public final static String TOPIC_GROUP = "group";
     public final static String TOPIC_ROLES = "roles";
-    public final static String TOPIC_ROLES_USERS = "roles.users";    
+    public final static String TOPIC_ROLE = "role";    
     public final static String TOPIC_PROFILES = "profiles";
 
     /** Messages **/

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/SecurityUtil.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/SecurityUtil.java?rev=354525&r1=354524&r2=354525&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/SecurityUtil.java (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/SecurityUtil.java Tue Dec  6 11:48:58 2005
@@ -93,4 +93,22 @@
         }                
     }
     
+    public static void publishErrorMessage(PortletRequest request, String topic, String message)
+    {
+        try
+        {
+            ArrayList errors = (ArrayList)PortletMessaging.receive(request,topic,SecurityResources.ERROR_MESSAGES);
+            if ( errors == null )
+            {
+                errors = new ArrayList();
+            }
+            errors.add(message);
+            PortletMessaging.publish(request, topic, SecurityResources.ERROR_MESSAGES, errors);
+        }
+        catch (NotSerializableException e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }                
+    }
 }

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/groups/GroupBrowser.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/groups/GroupBrowser.java?rev=354525&r1=354524&r2=354525&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/groups/GroupBrowser.java (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/groups/GroupBrowser.java Tue Dec  6 11:48:58 2005
@@ -31,6 +31,7 @@
 
 import org.apache.jetspeed.CommonPortletServices;
 import org.apache.jetspeed.portlets.security.SecurityResources;
+import org.apache.jetspeed.portlets.security.SecurityUtil;
 import org.apache.jetspeed.security.Group;
 import org.apache.jetspeed.security.GroupManager;
 import org.apache.jetspeed.security.SecurityException;
@@ -64,45 +65,40 @@
     }
            
     public void getRows(RenderRequest request, String sql, int windowSize)
-    throws Exception
     {
         getRows(request, sql, windowSize, "");
     }
     
     public void getRows(RenderRequest request, String sql, int windowSize, String filter)
-    throws Exception
     {
         List resultSetTitleList = new ArrayList();
         List resultSetTypeList = new ArrayList();
+        
+        resultSetTypeList.add(String.valueOf(Types.VARCHAR));
+        resultSetTitleList.add("group"); // resource bundle key
+
+        List list = new ArrayList();
+
         try
         {
             Iterator groups = groupManager.getGroups(filter);
                         
-            
-            resultSetTypeList.add(String.valueOf(Types.VARCHAR));
-            resultSetTitleList.add("Group");
-
-            List list = new ArrayList();
             while (groups.hasNext())
             {
                 Group group = (Group)groups.next();
                 
                 Principal principal = group.getPrincipal();                
                 list.add(principal.getName());
-            }            
-            
-            BrowserIterator iterator = new DatabaseBrowserIterator(
-                    list, resultSetTitleList, resultSetTypeList,
-                    windowSize);
-            setBrowserIterator(request, iterator);
-            iterator.sort("Group");
-        }
-        catch (Exception e)
-        {
-            //log.error("Exception in CMSBrowserAction.getRows: ", e);
-            e.printStackTrace();
-            throw e;
-        }        
+            }   
+        }
+        catch (SecurityException sex)
+        {
+            SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_GROUPS, sex.getMessage());
+        }                                    
+        
+        BrowserIterator iterator = new DatabaseBrowserIterator(list, resultSetTitleList, resultSetTypeList, windowSize);
+        setBrowserIterator(request, iterator);
+        iterator.sort("group"); // resource bundle key
     }
        
     public void doView(RenderRequest request, RenderResponse response)
@@ -131,6 +127,11 @@
             this.clearBrowserIterator(request);
         }                
         
+        ArrayList errorMessages = (ArrayList)PortletMessaging.consume(request, SecurityResources.TOPIC_GROUPS, SecurityResources.ERROR_MESSAGES);
+        if (errorMessages != null )
+        {
+            this.getContext(request).put(SecurityResources.ERROR_MESSAGES, errorMessages);
+        }
         
         super.doView(request, response);
     }
@@ -143,7 +144,7 @@
             String selected = request.getParameter("group");
             if (selected != null)
             {
-                Group group = lookupGroup(selected);
+                Group group = lookupGroup(request, selected);
                 if (group != null)
                 {
                     PortletMessaging.publish(request, SecurityResources.TOPIC_GROUPS, SecurityResources.MESSAGE_SELECTED, selected);
@@ -166,14 +167,15 @@
             
     }
 
-    private Group lookupGroup(String groupName)
+    private Group lookupGroup(ActionRequest actionRequest, String groupName)
     {
         try
         {
             return groupManager.getGroup(groupName);
         }
-        catch (SecurityException e)
+        catch (SecurityException sex)
         {
+            SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_GROUPS, sex.getMessage());
             return null;
         }
     }

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/groups/GroupDetails.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/groups/GroupDetails.java?rev=354525&r1=354524&r2=354525&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/groups/GroupDetails.java (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/groups/GroupDetails.java Tue Dec  6 11:48:58 2005
@@ -15,13 +15,13 @@
 package org.apache.jetspeed.portlets.security.groups;
 
 import java.io.IOException;
+import java.io.NotSerializableException;
 import java.security.Principal;
 import java.sql.Types;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
-import java.util.ResourceBundle;
 import java.util.StringTokenizer;
 
 import javax.portlet.ActionRequest;
@@ -36,6 +36,9 @@
 import org.apache.jetspeed.portlets.security.SecurityResources;
 import org.apache.jetspeed.portlets.security.SecurityUtil;
 import org.apache.jetspeed.security.GroupManager;
+import org.apache.jetspeed.security.Role;
+import org.apache.jetspeed.security.RoleManager;
+import org.apache.jetspeed.security.SecurityException;
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.UserManager;
 import org.apache.jetspeed.security.UserPrincipal;
@@ -55,6 +58,7 @@
 public class GroupDetails extends BrowserPortlet
 {
     private UserManager userManager;
+    private RoleManager roleManager;
     private GroupManager groupManager;
         
     public void init(PortletConfig config)
@@ -66,6 +70,11 @@
         {
             throw new PortletException("Failed to find the User Manager on portlet initialization");
         }
+        roleManager = (RoleManager) getPortletContext().getAttribute(CommonPortletServices.CPS_ROLE_MANAGER_COMPONENT);
+        if (null == roleManager)
+        {
+            throw new PortletException("Failed to find the Role Manager on portlet initialization");
+        }
         groupManager = (GroupManager) getPortletContext().getAttribute(CommonPortletServices.CPS_GROUP_MANAGER_COMPONENT);
         if (null == groupManager)
         {
@@ -74,13 +83,11 @@
     }
     
     public void getRows(RenderRequest request, String sql, int windowSize)
-    throws Exception
     {
         getRows(request, sql, windowSize, null);        
     }
 
     public void getRows(RenderRequest request, String sql, int windowSize, String filter)
-    throws Exception
     {
         List resultSetTitleList = new ArrayList();
         List resultSetTypeList = new ArrayList();
@@ -96,40 +103,73 @@
             }
         }
         
-        try
+        List list = new ArrayList();
+        resultSetTypeList.add(String.valueOf(Types.VARCHAR));
+        
+        String groupTab = request.getParameter("groupTab");
+        if ( groupTab == null )
         {
-            List list = new ArrayList();
-            resultSetTypeList.add(String.valueOf(Types.VARCHAR));
-            resultSetTitleList.add("Users in Group");
+            groupTab = "users";
+        }            
+        if ("users".equals(groupTab))
+        {
+            resultSetTitleList.add("usersingroup"); // resource bundle key
             
             String selectedGroup = (String)PortletMessaging.receive(request, SecurityResources.TOPIC_GROUPS, SecurityResources.MESSAGE_SELECTED);
             if (selectedGroup != null)
             {
-                Iterator users = userManager.getUsersInGroup(selectedGroup).iterator();                                    
-                while (users.hasNext())
+                try
                 {
-                    User user = (User)users.next();
-                    Principal principal = SecurityUtil.getPrincipal(user.getSubject(),
-                            UserPrincipal.class);
-                    if ( filter == null || principal.getName().toLowerCase().startsWith(filter))
+                    Iterator users = userManager.getUsersInGroup(selectedGroup).iterator();
+                    while (users.hasNext())
                     {
-                        list.add(principal.getName());
+                        User user = (User)users.next();
+                        Principal principal = SecurityUtil.getPrincipal(user.getSubject(),
+                                UserPrincipal.class);
+                        if ( filter == null || principal.getName().toLowerCase().startsWith(filter))
+                        {
+                            list.add(principal.getName());
+                        }
                     }
-                }
+                } 
+                catch (SecurityException sex)
+                {
+                    SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_GROUP, sex.getMessage());
+                }                                    
+                
             }
-            BrowserIterator iterator = new DatabaseBrowserIterator(
-                    list, resultSetTitleList, resultSetTypeList,
-                    windowSize);
+            BrowserIterator iterator = new DatabaseBrowserIterator(list, resultSetTitleList, resultSetTypeList, windowSize);
             setBrowserIterator(request, iterator);
-            iterator.sort("Users in Group");
+            iterator.sort("usersingroup"); // resource bundle key
         }
-        catch (Exception e)
+        else
         {
-            //log.error("Exception in CMSBrowserAction.getRows: ", e);
-            e.printStackTrace();
-            throw e;
-        }        
-        
+            resultSetTitleList.add("rolesingroup"); // resource bundle key
+            
+            String selectedGroup = (String)PortletMessaging.receive(request, SecurityResources.TOPIC_GROUPS, SecurityResources.MESSAGE_SELECTED);
+            if (selectedGroup != null)
+            {
+                try
+                {
+                    Iterator roles = roleManager.getRolesInGroup(selectedGroup).iterator();                                    
+                    while (roles.hasNext())
+                    {
+                        String roleName = ((Role)roles.next()).getPrincipal().getName();
+                        if ( filter == null || roleName.toLowerCase().startsWith(filter))
+                        {
+                            list.add(roleName);
+                        }
+                    }
+                } 
+                catch (SecurityException sex)
+                {
+                    SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_GROUP, sex.getMessage());
+                }                                    
+            }
+            BrowserIterator iterator = new DatabaseBrowserIterator(list, resultSetTitleList, resultSetTypeList, windowSize);
+            setBrowserIterator(request, iterator);
+            iterator.sort("usersingroup"); // resource bundle key
+        }
     }
            
     public void doView(RenderRequest request, RenderResponse response)
@@ -139,7 +179,9 @@
         if (change != null)
         { 
             this.clearBrowserIterator(request);
+            PortletMessaging.cancel(request, SecurityResources.TOPIC_GROUP, SecurityResources.MESSAGE_FILTERED);
         }
+
         Context context = this.getContext(request);
                 
         String selectedGroup = (String)PortletMessaging.receive(request, SecurityResources.TOPIC_GROUPS, SecurityResources.MESSAGE_SELECTED);
@@ -147,28 +189,48 @@
         {        
             context.put("group", selectedGroup);
         }        
+        String groupTab = request.getParameter("groupTab");
+        if ( groupTab == null )
+        {
+            groupTab = "users";
+        }
+        context.put("groupTab",groupTab);
         
-        String userChooser = SecurityUtil.getAbsoluteUrl(request, "/Administrative/choosers/multiusers.psml");        
-        context.put("userChooser", userChooser);
+        if ("users".equals(groupTab))
+        {
+            String popupChooser = SecurityUtil.getAbsoluteUrl(request, "/Administrative/choosers/multiusers.psml");        
+            context.put("popupChooser", popupChooser);            
+        }
+        else
+        {
+            String popupChooser = SecurityUtil.getAbsoluteUrl(request, "/Administrative/choosers/multiroles.psml");        
+            context.put("popupChooser", popupChooser);
+        }
         
-        StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, SecurityResources.TOPIC_GROUPS_USERS, SecurityResources.MESSAGE_STATUS);
+        StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, SecurityResources.TOPIC_GROUP, SecurityResources.MESSAGE_STATUS);
         if (msg != null)
         {
             this.getContext(request).put("statusMsg", msg);            
         }
           
-        String filtered = (String)PortletMessaging.receive(request, SecurityResources.TOPIC_GROUPS, SecurityResources.MESSAGE_FILTERED);
+        String filtered = (String)PortletMessaging.receive(request, SecurityResources.TOPIC_GROUP, SecurityResources.MESSAGE_FILTERED);
         if (filtered != null)
         {
             this.getContext(request).put(FILTERED, "on");            
         }        
-
-        String refresh = (String)PortletMessaging.consume(request, SecurityResources.TOPIC_GROUPS_USERS, SecurityResources.MESSAGE_REFRESH); 
+        
+        String refresh = (String)PortletMessaging.consume(request, SecurityResources.TOPIC_GROUP, SecurityResources.MESSAGE_REFRESH); 
         if (refresh != null)
         {        
             this.clearBrowserIterator(request);
         }                
-        
+
+        ArrayList errorMessages = (ArrayList)PortletMessaging.consume(request, SecurityResources.TOPIC_GROUP, SecurityResources.ERROR_MESSAGES);
+        if (errorMessages != null )
+        {
+            this.getContext(request).put(SecurityResources.ERROR_MESSAGES, errorMessages);
+        }
+
         super.doView(request, response);
     }
         
@@ -178,31 +240,71 @@
     {
         if (request.getPortletMode() == PortletMode.VIEW)
         {
-            String users = request.getParameter("users");
+            String groupTab = request.getParameter("groupTab");
+            if ( groupTab == null )
+            {
+                PortletMessaging.publish(request, SecurityResources.TOPIC_GROUP, SecurityResources.MESSAGE_REFRESH, "true");                        
+                PortletMessaging.cancel(request, SecurityResources.TOPIC_GROUP, SecurityResources.MESSAGE_FILTERED);
+                groupTab = request.getParameter("switchTab");
+                if ( groupTab == null )
+                {
+                    // should never happen
+                    groupTab = "users";
+                }
+            }
+            response.setRenderParameter("groupTab",groupTab);
+
             
-            System.out.println("users = " + users);
-            if (users != null && users.length() > 0)
+            if (request.getParameter("group.action.Save") != null)
             {
-                addUsersToGroup(request, users);
+                addGroup(request);
             }
             else if (request.getParameter("group.action.Add_New_Group") != null)
             {
                 PortletMessaging.cancel(request, SecurityResources.TOPIC_GROUPS, SecurityResources.MESSAGE_SELECTED);                
             }
-            else if (request.getParameter("group.action.Remove_Checked_Users") != null)
-            {
-                removeUsersFromGroup(request);
-            }
             else if (request.getParameter("group.action.Remove_Group") != null)
             {
                 removeGroup(request);
             }
-            else if (request.getParameter("group.action.Save") != null)
+            else if ("users".equals(groupTab))
             {
-                addGroup(request);
+                String users = request.getParameter("users");
+                
+                if (users != null && users.length() > 0)
+                {
+                    addUsersToGroup(request, users);
+                }
+                else if (request.getParameter("group.action.Remove_Checked_Users") != null)
+                {
+                    removeUsersFromGroup(request);
+                }
+            }
+            else
+            {
+                String roles = request.getParameter("roles");
+                
+                if (roles != null && roles.length() > 0)
+                {
+                    addRolesToGroup(request, roles);
+                }
+                else if (request.getParameter("group.action.Remove_Checked_Roles") != null)
+                {
+                    removeRolesFromGroup(request);
+                }
             }
             
+            if (request.getParameter(FILTERED) != null )
+            {
+                PortletMessaging.publish(request, SecurityResources.TOPIC_GROUP, SecurityResources.MESSAGE_FILTERED, "on");            
+            }
+            else
+            {
+                PortletMessaging.cancel(request, SecurityResources.TOPIC_GROUP, SecurityResources.MESSAGE_FILTERED);                    
+            }
         }
+        
+        
         super.processAction(request, response);            
     }
 
@@ -212,16 +314,19 @@
         if (!SecurityUtil.isEmpty(group)) 
         {
             try
-            {            
+            {
                 groupManager.addGroup(group);
-                PortletMessaging.publish(actionRequest, 
-                        SecurityResources.TOPIC_GROUPS, 
-                        SecurityResources.MESSAGE_REFRESH, "true");
-            }            
-            catch (Exception se)
+                PortletMessaging.publish(actionRequest, SecurityResources.TOPIC_GROUPS, SecurityResources.MESSAGE_REFRESH, "true");
+                PortletMessaging.publish(actionRequest, SecurityResources.TOPIC_GROUPS, SecurityResources.MESSAGE_SELECTED, group);
+                PortletMessaging.publish(actionRequest, SecurityResources.TOPIC_GROUPS, SecurityResources.MESSAGE_CHANGED, group);
+            } 
+            catch (NotSerializableException e)
+            {
+                e.printStackTrace();
+            }
+            catch (SecurityException sex)
             {
-                ResourceBundle bundle = ResourceBundle.getBundle("org.apache.jetspeed.portlets.security.resources.UsersResources",actionRequest.getLocale());                
-                SecurityUtil.publishErrorMessage(actionRequest, bundle.getString("user.exists"));
+                SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_GROUP, sex.getMessage());
             }
         }
     }
@@ -234,16 +339,20 @@
             try
             {            
                 groupManager.removeGroup(group);
-                PortletMessaging.publish(actionRequest, 
-                        SecurityResources.TOPIC_GROUPS, 
-                        SecurityResources.MESSAGE_REFRESH, "true");
+                try
+                {
+                    PortletMessaging.publish(actionRequest, SecurityResources.TOPIC_GROUPS, SecurityResources.MESSAGE_REFRESH, "true");
+                } 
+                catch (NotSerializableException e)
+                {
+                    e.printStackTrace();
+                }
                 PortletMessaging.cancel(actionRequest, SecurityResources.TOPIC_GROUPS, SecurityResources.MESSAGE_SELECTED);                                                
             }
-            catch (Exception se)
+            catch (SecurityException sex)
             {
-                ResourceBundle bundle = ResourceBundle.getBundle("org.apache.jetspeed.portlets.security.resources.UsersResources",actionRequest.getLocale());                
-                SecurityUtil.publishErrorMessage(actionRequest, bundle.getString("user.exists"));
-            }
+                SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_GROUP, sex.getMessage());
+            } 
         }
     }
     
@@ -266,21 +375,21 @@
                         count++;
                     }
                 }
-                catch (Exception e)
+                catch (SecurityException sex)
                 {
-                    System.err.println("failed to add user to group: " + user);
+                    SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_GROUP, sex.getMessage());
                 }
             }
             if (count > 0)
             {
                 try
                 {
-                    PortletMessaging.publish(request, 
-                            SecurityResources.TOPIC_GROUPS_USERS, 
-                            SecurityResources.MESSAGE_REFRESH, "true");
+                    PortletMessaging.publish(request, SecurityResources.TOPIC_GROUP, SecurityResources.MESSAGE_REFRESH, "true");
                 }
                 catch (Exception e)
-                {}
+                {
+                    e.printStackTrace();
+                }
             }
         }
     }
@@ -303,9 +412,9 @@
                         groupManager.removeUserFromGroup(user, group);                        
                         count++;
                     }
-                    catch (Exception e1)
+                    catch (SecurityException sex)
                     {
-                        System.err.println("failed to remove user from group: " + user);
+                        SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_GROUP, sex.getMessage());
                     }
                     
                 }
@@ -314,14 +423,90 @@
             {
                 try
                 {
-                    PortletMessaging.publish(request, 
-                            SecurityResources.TOPIC_GROUPS_USERS, 
-                            SecurityResources.MESSAGE_REFRESH, "true");
+                    PortletMessaging.publish(request, SecurityResources.TOPIC_GROUP, SecurityResources.MESSAGE_REFRESH, "true");
+                }
+                catch (Exception ex)
+                {
+                    ex.printStackTrace();
                 }
-                catch (Exception e2)
-                {}
             }
         }
     }
     
+    protected void addRolesToGroup(ActionRequest request, String roles)
+    {
+        String group = request.getParameter("group");
+        if (group != null)
+        {
+            int count = 0;
+            StringTokenizer tokenizer = new StringTokenizer(roles, ",");
+            while (tokenizer.hasMoreTokens())
+            {
+                String role = tokenizer.nextToken();
+                try
+                {
+                    if (role.startsWith("box_"))
+                    {
+                        role = role.substring("box_".length());
+                        roleManager.addRoleToGroup(role, group);
+                        count++;
+                    }
+                }
+                catch (SecurityException sex)
+                {
+                    SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_GROUP, sex.getMessage());
+                }
+            }
+            if (count > 0)
+            {
+                try
+                {
+                    PortletMessaging.publish(request, SecurityResources.TOPIC_GROUP, SecurityResources.MESSAGE_REFRESH, "true");
+                }
+                catch (Exception e)
+                {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+    protected void removeRolesFromGroup(ActionRequest request)
+    {
+        String group = request.getParameter("group");
+        if (group != null)
+        {
+            int count = 0;
+            Enumeration e = request.getParameterNames();
+            while (e.hasMoreElements())
+            {
+                String name = (String)e.nextElement();
+                if (name.startsWith("box_"))
+                {
+                    String role = name.substring("box_".length());
+                    try
+                    {
+                        roleManager.removeRoleFromGroup(role, group);                        
+                        count++;
+                    }
+                    catch (SecurityException sex)
+                    {
+                        SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_GROUP, sex.getMessage());
+                    }
+                    
+                }
+            }
+            if (count > 0)
+            {
+                try
+                {
+                    PortletMessaging.publish(request, SecurityResources.TOPIC_GROUP, SecurityResources.MESSAGE_REFRESH, "true");
+                }
+                catch (Exception ex)
+                {
+                    ex.printStackTrace();
+                }
+            }
+        }
+    }
 }

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleBrowser.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleBrowser.java?rev=354525&r1=354524&r2=354525&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleBrowser.java (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleBrowser.java Tue Dec  6 11:48:58 2005
@@ -31,6 +31,7 @@
 
 import org.apache.jetspeed.CommonPortletServices;
 import org.apache.jetspeed.portlets.security.SecurityResources;
+import org.apache.jetspeed.portlets.security.SecurityUtil;
 import org.apache.jetspeed.security.Role;
 import org.apache.jetspeed.security.RoleManager;
 import org.apache.jetspeed.security.SecurityException;
@@ -64,45 +65,37 @@
     }
            
     public void getRows(RenderRequest request, String sql, int windowSize)
-    throws Exception
     {
         getRows(request, sql, windowSize, "");
     }
     
     public void getRows(RenderRequest request, String sql, int windowSize, String filter)
-    throws Exception
     {
         List resultSetTitleList = new ArrayList();
         List resultSetTypeList = new ArrayList();
+        resultSetTypeList.add(String.valueOf(Types.VARCHAR));
+        resultSetTitleList.add("role"); // resource bundle key
+
+        List list = new ArrayList();
         try
         {
             Iterator roles = roleManager.getRoles(filter);
-                        
             
-            resultSetTypeList.add(String.valueOf(Types.VARCHAR));
-            resultSetTitleList.add("Role");
-
-            List list = new ArrayList();
             while (roles.hasNext())
             {
                 Role role = (Role)roles.next();
                 
                 Principal principal = role.getPrincipal();                
                 list.add(principal.getName());
-            }            
-            
-            BrowserIterator iterator = new DatabaseBrowserIterator(
-                    list, resultSetTitleList, resultSetTypeList,
-                    windowSize);
-            setBrowserIterator(request, iterator);
-            iterator.sort("Role");
-        }
-        catch (Exception e)
-        {
-            //log.error("Exception in CMSBrowserAction.getRows: ", e);
-            e.printStackTrace();
-            throw e;
-        }        
+            }                        
+        }
+        catch (SecurityException sex)
+        {
+            SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_ROLES, sex.getMessage());
+        }                                    
+        BrowserIterator iterator = new DatabaseBrowserIterator(list, resultSetTitleList, resultSetTypeList,windowSize);
+        setBrowserIterator(request, iterator);
+        iterator.sort("role"); // resource bundle key
     }
        
     public void doView(RenderRequest request, RenderResponse response)
@@ -132,6 +125,12 @@
             this.clearBrowserIterator(request);
         }                
                 
+        ArrayList errorMessages = (ArrayList)PortletMessaging.consume(request, SecurityResources.TOPIC_ROLES, SecurityResources.ERROR_MESSAGES);
+        if (errorMessages != null )
+        {
+            this.getContext(request).put(SecurityResources.ERROR_MESSAGES, errorMessages);
+        }
+        
         super.doView(request, response);
     }
 
@@ -143,7 +142,7 @@
             String selected = request.getParameter("role");
             if (selected != null)
             {
-                Role role = lookupRole(selected);
+                Role role = lookupRole(request, selected);
                 if (role != null)
                 {
                     PortletMessaging.publish(request, SecurityResources.TOPIC_ROLES, SecurityResources.MESSAGE_SELECTED, selected);
@@ -166,17 +165,16 @@
             
     }
 
-    private Role lookupRole(String roleName)
+    private Role lookupRole(ActionRequest actionRequest, String roleName)
     {
         try
         {
             return roleManager.getRole(roleName);
         }
-        catch (SecurityException e)
+        catch (SecurityException sex)
         {
+            SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_ROLES, sex.getMessage());
             return null;
         }
     }
-    
-    
 }

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleChooserPortlet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleChooserPortlet.java?rev=354525&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleChooserPortlet.java (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleChooserPortlet.java Tue Dec  6 11:48:58 2005
@@ -0,0 +1,87 @@
+/* Copyright 2004 Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.jetspeed.portlets.security.roles;
+
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+
+import org.apache.jetspeed.CommonPortletServices;
+import org.apache.jetspeed.security.Role;
+import org.apache.jetspeed.security.RoleManager;
+import org.apache.portals.gems.browser.BrowserIterator;
+import org.apache.portals.gems.browser.BrowserPortlet;
+import org.apache.portals.gems.browser.DatabaseBrowserIterator;
+
+/**
+ * RoleChooserPortlet
+ * 
+ * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
+ * @version $Id$
+ */
+public class RoleChooserPortlet extends BrowserPortlet
+{
+    private RoleManager roleManager;
+    
+    public void init(PortletConfig config)
+    throws PortletException 
+    {
+        super.init(config);
+        roleManager = (RoleManager) getPortletContext().getAttribute(CommonPortletServices.CPS_ROLE_MANAGER_COMPONENT);
+        if (null == roleManager)
+        {
+            throw new PortletException("Failed to find the Role Manager on portlet initialization");
+        }
+    }
+           
+    public void getRows(RenderRequest request, String sql, int windowSize)
+    throws Exception
+    {
+        List resultSetTitleList = new ArrayList();
+        List resultSetTypeList = new ArrayList();
+        try
+        {
+            Iterator roles = roleManager.getRoles("");
+                        
+            
+            resultSetTypeList.add(String.valueOf(Types.VARCHAR));
+            resultSetTitleList.add("Role");
+
+            // TODO: need to try to normalize List/Collection/Iterators
+            List list = new ArrayList();
+            while (roles.hasNext())
+            {
+                list.add(((Role)roles.next()).getPrincipal().getName());
+            }            
+            BrowserIterator iterator = new DatabaseBrowserIterator(
+                    list, resultSetTitleList, resultSetTypeList,
+                    windowSize);
+            setBrowserIterator(request, iterator);
+            iterator.sort("Role");
+        }
+        catch (Exception e)
+        {
+            //log.error("Exception in CMSBrowserAction.getRows: ", e);
+            e.printStackTrace();
+            throw e;
+        }        
+    }
+       
+}

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleDetails.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleDetails.java?rev=354525&r1=354524&r2=354525&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleDetails.java (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/roles/RoleDetails.java Tue Dec  6 11:48:58 2005
@@ -15,13 +15,13 @@
 package org.apache.jetspeed.portlets.security.roles;
 
 import java.io.IOException;
+import java.io.NotSerializableException;
 import java.security.Principal;
 import java.sql.Types;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
-import java.util.ResourceBundle;
 import java.util.StringTokenizer;
 
 import javax.portlet.ActionRequest;
@@ -36,6 +36,7 @@
 import org.apache.jetspeed.portlets.security.SecurityResources;
 import org.apache.jetspeed.portlets.security.SecurityUtil;
 import org.apache.jetspeed.security.RoleManager;
+import org.apache.jetspeed.security.SecurityException;
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.UserManager;
 import org.apache.jetspeed.security.UserPrincipal;
@@ -74,13 +75,11 @@
     }
     
     public void getRows(RenderRequest request, String sql, int windowSize)
-    throws Exception
     {
         getRows(request, sql, windowSize, null);        
     }
 
     public void getRows(RenderRequest request, String sql, int windowSize, String filter)
-    throws Exception
     {
         List resultSetTitleList = new ArrayList();
         List resultSetTypeList = new ArrayList();
@@ -96,14 +95,14 @@
             }
         }
         
-        try
+        List list = new ArrayList();
+        resultSetTypeList.add(String.valueOf(Types.VARCHAR));
+        resultSetTitleList.add("Users in Role");
+        
+        String selectedRole = (String)PortletMessaging.receive(request, SecurityResources.TOPIC_ROLES, SecurityResources.MESSAGE_SELECTED);
+        if (selectedRole != null)
         {
-            List list = new ArrayList();
-            resultSetTypeList.add(String.valueOf(Types.VARCHAR));
-            resultSetTitleList.add("Users in Role");
-            
-            String selectedRole = (String)PortletMessaging.receive(request, SecurityResources.TOPIC_ROLES, SecurityResources.MESSAGE_SELECTED);
-            if (selectedRole != null)
+            try
             {
                 Iterator users = userManager.getUsersInRole(selectedRole).iterator();                                    
                 while (users.hasNext())
@@ -116,20 +115,15 @@
                         list.add(principal.getName());
                     }
                 }
-            }
-            BrowserIterator iterator = new DatabaseBrowserIterator(
-                    list, resultSetTitleList, resultSetTypeList,
-                    windowSize);
-            setBrowserIterator(request, iterator);
-            iterator.sort("Users in Role");
-        }
-        catch (Exception e)
-        {
-            //log.error("Exception in CMSBrowserAction.getRows: ", e);
-            e.printStackTrace();
-            throw e;
-        }        
-        
+            } 
+            catch (SecurityException sex)
+            {
+                SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_ROLE, sex.getMessage());
+            }                                    
+        }
+        BrowserIterator iterator = new DatabaseBrowserIterator(list, resultSetTitleList, resultSetTypeList, windowSize);
+        setBrowserIterator(request, iterator);
+        iterator.sort("Users in Role");
     }
            
     public void doView(RenderRequest request, RenderResponse response)
@@ -151,24 +145,30 @@
         String userChooser = SecurityUtil.getAbsoluteUrl(request, "/Administrative/choosers/multiusers.psml");        
         context.put("userChooser", userChooser);
         
-        StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, SecurityResources.TOPIC_ROLES_USERS, SecurityResources.MESSAGE_STATUS);
+        StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, SecurityResources.TOPIC_ROLE, SecurityResources.MESSAGE_STATUS);
         if (msg != null)
         {
             this.getContext(request).put("statusMsg", msg);            
         }
           
-        String filtered = (String)PortletMessaging.receive(request, SecurityResources.TOPIC_ROLES, SecurityResources.MESSAGE_FILTERED);
+        String filtered = (String)PortletMessaging.receive(request, SecurityResources.TOPIC_ROLE, SecurityResources.MESSAGE_FILTERED);
         if (filtered != null)
         {
             this.getContext(request).put(FILTERED, "on");            
         }
 
-        String refresh = (String)PortletMessaging.consume(request, SecurityResources.TOPIC_ROLES_USERS, SecurityResources.MESSAGE_REFRESH); 
+        String refresh = (String)PortletMessaging.consume(request, SecurityResources.TOPIC_ROLE, SecurityResources.MESSAGE_REFRESH); 
         if (refresh != null)
         {        
             this.clearBrowserIterator(request);
         }                
         
+        ArrayList errorMessages = (ArrayList)PortletMessaging.consume(request, SecurityResources.TOPIC_ROLE, SecurityResources.ERROR_MESSAGES);
+        if (errorMessages != null )
+        {
+            this.getContext(request).put(SecurityResources.ERROR_MESSAGES, errorMessages);
+        }
+
         super.doView(request, response);
     }
         
@@ -200,7 +200,15 @@
             {
                 addRole(request);
             }
-            
+
+            if (request.getParameter(FILTERED) != null )
+            {
+                PortletMessaging.publish(request, SecurityResources.TOPIC_ROLE, SecurityResources.MESSAGE_FILTERED, "on");            
+            }
+            else
+            {
+                PortletMessaging.cancel(request, SecurityResources.TOPIC_ROLE, SecurityResources.MESSAGE_FILTERED);                    
+            }            
         }
         super.processAction(request, response);            
     }
@@ -213,14 +221,17 @@
             try
             {            
                 roleManager.addRole(role);
-                PortletMessaging.publish(actionRequest, 
-                        SecurityResources.TOPIC_ROLES, 
-                        SecurityResources.MESSAGE_REFRESH, "true");
+                PortletMessaging.publish(actionRequest, SecurityResources.TOPIC_ROLES, SecurityResources.MESSAGE_REFRESH, "true");
+                PortletMessaging.publish(actionRequest, SecurityResources.TOPIC_ROLES, SecurityResources.MESSAGE_SELECTED, role);
+                PortletMessaging.publish(actionRequest, SecurityResources.TOPIC_ROLES, SecurityResources.MESSAGE_CHANGED, role);
             }            
-            catch (Exception se)
+            catch (SecurityException sex)
+            {
+                SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_ROLE, sex.getMessage());
+            }
+            catch (NotSerializableException e)
             {
-                ResourceBundle bundle = ResourceBundle.getBundle("org.apache.jetspeed.portlets.security.resources.UsersResources",actionRequest.getLocale());                
-                SecurityUtil.publishErrorMessage(actionRequest, bundle.getString("user.exists"));
+                e.printStackTrace();
             }
         }
     }
@@ -233,16 +244,20 @@
             try
             {            
                 roleManager.removeRole(role);
-                PortletMessaging.publish(actionRequest, 
-                        SecurityResources.TOPIC_ROLES, 
-                        SecurityResources.MESSAGE_REFRESH, "true");
+                try
+                {
+                PortletMessaging.publish(actionRequest, SecurityResources.TOPIC_ROLES, SecurityResources.MESSAGE_REFRESH, "true");
+                }
+                catch (NotSerializableException e)
+                {
+                    e.printStackTrace();
+                }
                 PortletMessaging.cancel(actionRequest, SecurityResources.TOPIC_ROLES, SecurityResources.MESSAGE_SELECTED);                                                
             }
-            catch (Exception se)
+            catch (SecurityException sex)
             {
-                ResourceBundle bundle = ResourceBundle.getBundle("org.apache.jetspeed.portlets.security.resources.UsersResources",actionRequest.getLocale());                
-                SecurityUtil.publishErrorMessage(actionRequest, bundle.getString("user.exists"));
-            }
+                SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_ROLE, sex.getMessage());
+            } 
         }
     }
     
@@ -265,21 +280,21 @@
                         count++;
                     }
                 }
-                catch (Exception e)
+                catch (SecurityException sex)
                 {
-                    System.err.println("failed to add user to role: " + user);
+                    SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_ROLE, sex.getMessage());
                 }
             }
             if (count > 0)
             {
                 try
                 {
-                    PortletMessaging.publish(request, 
-                            SecurityResources.TOPIC_ROLES_USERS, 
-                            SecurityResources.MESSAGE_REFRESH, "true");
+                    PortletMessaging.publish(request, SecurityResources.TOPIC_ROLE, SecurityResources.MESSAGE_REFRESH, "true");
                 }
                 catch (Exception e)
-                {}
+                {
+                    e.printStackTrace();
+                }
             }
         }
     }
@@ -302,23 +317,22 @@
                         roleManager.removeRoleFromUser(user, role);
                         count++;
                     }
-                    catch (Exception e1)
+                    catch (SecurityException sex)
                     {
-                        System.err.println("failed to remove user from role: " + user);
+                        SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_ROLE, sex.getMessage());
                     }
-                    
                 }
             }
             if (count > 0)
             {
                 try
                 {
-                    PortletMessaging.publish(request, 
-                            SecurityResources.TOPIC_ROLES_USERS, 
-                            SecurityResources.MESSAGE_REFRESH, "true");
+                    PortletMessaging.publish(request, SecurityResources.TOPIC_ROLE, SecurityResources.MESSAGE_REFRESH, "true");
+                }
+                catch (Exception ex)
+                {
+                    ex.printStackTrace();
                 }
-                catch (Exception e2)
-                {}
             }
         }
     }

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/users/UserBrowser.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/users/UserBrowser.java?rev=354525&r1=354524&r2=354525&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/users/UserBrowser.java (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/users/UserBrowser.java Tue Dec  6 11:48:58 2005
@@ -32,6 +32,7 @@
 import org.apache.jetspeed.CommonPortletServices;
 import org.apache.jetspeed.portlets.security.SecurityUtil;
 import org.apache.jetspeed.portlets.security.SecurityResources;
+import org.apache.jetspeed.security.SecurityException;
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.UserManager;
 import org.apache.jetspeed.security.UserPrincipal;
@@ -94,6 +95,12 @@
             this.getContext(request).put(FILTERED, "on");            
         }
         
+        ArrayList errorMessages = (ArrayList)PortletMessaging.consume(request, SecurityResources.TOPIC_USERS, SecurityResources.ERROR_MESSAGES);
+        if (errorMessages != null )
+        {
+            this.getContext(request).put(SecurityResources.ERROR_MESSAGES, errorMessages);
+        }
+        
         super.doView(request, response);
     }
         
@@ -120,50 +127,39 @@
             PortletMessaging.cancel(request, SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_FILTERED);
         }
         
-        super.processAction(request, response);
-            
+        super.processAction(request, response);            
     }
       
     public void getRows(RenderRequest request, String sql, int windowSize)
-    throws Exception
     {
         getRows(request, sql, windowSize, "");
     }
 
     public void getRows(RenderRequest request, String sql, int windowSize, String filter)
-    throws Exception
     {
         List resultSetTitleList = new ArrayList();
         List resultSetTypeList = new ArrayList();
+        resultSetTypeList.add(String.valueOf(Types.VARCHAR));
+        resultSetTitleList.add("user"); // resource bundle key
+
+        List list = new ArrayList();
         try
         {
             Iterator users = userManager.getUsers(filter);
-                        
-            
-            resultSetTypeList.add(String.valueOf(Types.VARCHAR));
-            resultSetTitleList.add("User");
 
-            List list = new ArrayList();
             while (users.hasNext())
             {
                 User user = (User)users.next();
-                Principal principal = SecurityUtil.getPrincipal(user.getSubject(),
-                        UserPrincipal.class);                
+                Principal principal = SecurityUtil.getPrincipal(user.getSubject(),UserPrincipal.class);                
                 list.add(principal.getName());
             }            
-            BrowserIterator iterator = new DatabaseBrowserIterator(
-                    list, resultSetTitleList, resultSetTypeList,
-                    windowSize);
-            setBrowserIterator(request, iterator);
-            iterator.sort("User");
-        }
-        catch (Exception e)
-        {
-            //log.error("Exception in CMSBrowserAction.getRows: ", e);
-            e.printStackTrace();
-            throw e;
-        }        
-        
-    }
-    
+        }
+        catch (SecurityException sex)
+        {
+            SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_USERS, sex.getMessage());
+        }                                    
+        BrowserIterator iterator = new DatabaseBrowserIterator(list, resultSetTitleList, resultSetTypeList, windowSize);
+        setBrowserIterator(request, iterator);
+        iterator.sort("user"); // resource bundle key        
+    }    
 }

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/users/UserDetailsPortlet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/users/UserDetailsPortlet.java?rev=354525&r1=354524&r2=354525&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/users/UserDetailsPortlet.java (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/users/UserDetailsPortlet.java Tue Dec  6 11:48:58 2005
@@ -188,7 +188,7 @@
         User user = null;
         if (userName != null)
         {
-            user = lookupUser(userName);
+            user = lookupUser(request, userName);
         }
         
         if (user != null)
@@ -225,12 +225,12 @@
                 request.setAttribute(VIEW_PA_USER_ATTRIBUTES, paUserAttributes);
                 if ( "true".equals(request.getPreferences().getValue("showPasswordOnUserTab", "false")))
                 {
-                    request.setAttribute(VIEW_CREDENTIAL, getCredential(userName));
+                    request.setAttribute(VIEW_CREDENTIAL, getCredential(request, userName));
                 }
             }
             else if (selectedTab.getId().equals(TAB_ROLE))
             {                
-                Collection userRoles = getRoles(userName);
+                Collection userRoles = getRoles(request, userName);
                 request.setAttribute(VIEW_ROLES, userRoles );
                 
                 // check for refresh on roles list
@@ -276,7 +276,7 @@
             }
             else if (selectedTab.getId().equals(TAB_GROUP))
             {
-                Collection userGroups = getGroups(userName);
+                Collection userGroups = getGroups(request, userName);
                 request.setAttribute(VIEW_GROUPS, userGroups);
                 
                 // check for refresh on groups list
@@ -327,7 +327,7 @@
             }
             else if (selectedTab.getId().equals(TAB_CREDENTIAL))
             {
-                request.setAttribute(VIEW_CREDENTIAL, getCredential(userName));
+                request.setAttribute(VIEW_CREDENTIAL, getCredential(request, userName));
             }
            
             request.setAttribute(SecurityResources.REQUEST_SELECT_TAB, selectedTab);
@@ -338,7 +338,7 @@
             renderProfileInformation(request);            
         }
         // check for ErrorMessages
-        ArrayList errorMessages = (ArrayList)PortletMessaging.consume(request, SecurityResources.ERROR_MESSAGES);
+        ArrayList errorMessages = (ArrayList)PortletMessaging.consume(request, SecurityResources.TOPIC_USER, SecurityResources.ERROR_MESSAGES);
         if (errorMessages != null )
         {
             request.setAttribute(SecurityResources.ERROR_MESSAGES, errorMessages);
@@ -554,7 +554,7 @@
     {
         String userName = (String)PortletMessaging.receive(actionRequest, 
                 SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);        
-        User user = lookupUser(userName);
+        User user = lookupUser(actionRequest, userName);
         if (user != null)
         {
             try
@@ -574,9 +574,9 @@
                 // TODO: send message to site manager portlet
                 
             }
-            catch (Exception e)
+            catch (Exception ex)
             {
-                SecurityUtil.publishErrorMessage(actionRequest,e.getMessage());
+                SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, ex.getMessage());
             }
         }
     }
@@ -603,7 +603,7 @@
 
         String userName = (String)PortletMessaging.receive(actionRequest, 
                 SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);
-        User user = lookupUser(userName);
+        User user = lookupUser(actionRequest, userName);
         if (user != null)
         {
             try
@@ -615,7 +615,7 @@
                     userManager.setPassword(userName, null, password);
                     passwordSet = true;
                 }
-                PasswordCredential credential = getCredential(userName);
+                PasswordCredential credential = getCredential(actionRequest, userName);
                 if ( credential != null )
                 {
                     String updateRequiredStr = actionRequest.getParameter("user_cred_updreq");
@@ -657,19 +657,19 @@
             }
             catch ( InvalidPasswordException ipe )
             {
-                SecurityUtil.publishErrorMessage(actionRequest,bundle.getString("chgpwd.error.invalidPassword"));
+                SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, bundle.getString("chgpwd.error.invalidPassword"));
             }
             catch ( InvalidNewPasswordException inpe )
             {
-                SecurityUtil.publishErrorMessage(actionRequest,bundle.getString("chgpwd.error.invalidNewPassword"));
+                SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, bundle.getString("chgpwd.error.invalidNewPassword"));
             }
             catch ( PasswordAlreadyUsedException paue )
             {
-                SecurityUtil.publishErrorMessage(actionRequest,bundle.getString("chgpwd.error.passwordAlreadyUsed"));
+                SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, bundle.getString("chgpwd.error.passwordAlreadyUsed"));
             }
             catch (SecurityException e)
             {
-                SecurityUtil.publishErrorMessage(actionRequest,e.getMessage());
+                SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, e.getMessage());
             }
         }
     }
@@ -678,7 +678,7 @@
     {
         String userName = (String)PortletMessaging.receive(actionRequest, 
                 SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);
-        User user = lookupUser(userName);
+        User user = lookupUser(actionRequest, userName);
         if (user != null)
         {
             Iterator attrIter = paUserAttributes.iterator();
@@ -704,7 +704,7 @@
     {
         String userName = (String)PortletMessaging.receive(actionRequest, 
                 SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);
-        User user = lookupUser(userName);
+        User user = lookupUser(actionRequest, userName);
         if (user != null)
         {
             String[] userAttrNames = actionRequest.getParameterValues("user_attr_id");
@@ -724,7 +724,7 @@
     {
         String userName = (String)PortletMessaging.receive(actionRequest, 
                 SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);        
-        User user = lookupUser(userName);
+        User user = lookupUser(actionRequest, userName);
         if (user != null)
         {
             String userAttrName = actionRequest.getParameter("user_attr_name");
@@ -742,7 +742,7 @@
         String userName = (String)PortletMessaging.receive(actionRequest, 
                 SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);        
         
-        User user = lookupUser(userName);
+        User user = lookupUser(actionRequest, userName);
         if (user != null)
         {
             String[] userAttrNames = actionRequest.getParameterValues("user_attr_id");
@@ -756,7 +756,10 @@
                     {
                         attributes.remove(userAttrNames[ix]);
                     }
-                    catch (Exception e) {}
+                    catch (Exception e) 
+                    {
+                      e.printStackTrace();  
+                    }
                 }
             }            
         }
@@ -766,7 +769,7 @@
     {
         String userName = (String)PortletMessaging.receive(actionRequest, 
                 SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);
-        User user = lookupUser(userName);
+        User user = lookupUser(actionRequest, userName);
         if (user != null)
         {
             String[] roleNames = actionRequest.getParameterValues("user_role_id");
@@ -784,9 +787,7 @@
                     }
                     catch (SecurityException e)
                     {
-                        SecurityUtil.publishErrorMessage(actionRequest,e.getMessage());
-                        // TODO: logging
-                        System.err.println("failed to remove user from role: " + userName + ", "  + roleNames[ix] + e);                       
+                        SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, e.getMessage());
                     }                
                 }
             }            
@@ -797,7 +798,7 @@
     {
         String userName = (String)PortletMessaging.receive(actionRequest, 
                 SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);       
-        User user = lookupUser(userName);
+        User user = lookupUser(actionRequest, userName);
         if (user != null)
         {
             String roleName = actionRequest.getParameter("role_name");
@@ -809,9 +810,7 @@
                 }
                 catch (SecurityException e)
                 {
-                    SecurityUtil.publishErrorMessage(actionRequest,e.getMessage());
-                    // TODO: logging
-                    System.err.println("failed to add user to role: " + userName + ", "  + roleName + e);                       
+                    SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, e.getMessage());
                 }
             }
         }
@@ -821,7 +820,7 @@
     {
         String userName = (String)PortletMessaging.receive(actionRequest, 
                 SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);
-        User user = lookupUser(userName);
+        User user = lookupUser(actionRequest, userName);
         if (user != null)
         {
             String[] groupNames = actionRequest.getParameterValues("user_group_id");
@@ -839,9 +838,7 @@
                     }
                     catch (SecurityException e)
                     {
-                        SecurityUtil.publishErrorMessage(actionRequest,e.getMessage());
-                        // TODO: logging
-                        System.err.println("failed to remove user from group: " + userName + ", "  + groupNames[ix] + e);                       
+                        SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, e.getMessage());
                     }                
                 }
             }            
@@ -852,7 +849,7 @@
     {
         String userName = (String)PortletMessaging.receive(actionRequest, 
                 SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);
-        User user = lookupUser(userName);
+        User user = lookupUser(actionRequest, userName);
         if (user != null)
         {
             String groupName = actionRequest.getParameter("group_name");
@@ -864,9 +861,7 @@
                 }
                 catch (SecurityException e)
                 {
-                    SecurityUtil.publishErrorMessage(actionRequest,e.getMessage());
-                    // TODO: logging
-                    System.err.println("failed to add user to group: " + userName + ", "  + groupName + e);                       
+                    SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, e.getMessage());
                 }
             }
         }
@@ -882,7 +877,7 @@
         return action.startsWith(USER_ACTION_PREFIX);
     }
     
-    private Collection getRoles(String userName)
+    private Collection getRoles(PortletRequest request, String userName)
     {
         try
         {
@@ -890,13 +885,12 @@
         }
         catch (SecurityException e)
         {
-            // TODO: logging
-            System.err.println("roles not found: " + userName + ", " + e);       
+            SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_USER, e.getMessage());
         }
         return new LinkedList();
     }
     
-    private Collection getGroups(String userName)
+    private Collection getGroups(PortletRequest request, String userName)
     {
         try
         {
@@ -904,8 +898,7 @@
         }
         catch (SecurityException e)
         {
-            // TODO: logging
-            System.err.println("groups not found: " + userName + ", " + e);       
+            SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_USER, e.getMessage());
         }
         return new LinkedList();
     }
@@ -927,12 +920,12 @@
         }
         return credential;
     }
-    private PasswordCredential getCredential(String userName)
+    private PasswordCredential getCredential(PortletRequest request, String userName)
     {
-        return getCredential(lookupUser(userName));
+        return getCredential(lookupUser(request, userName));
     }
     
-    private User lookupUser(String userName)
+    private User lookupUser(PortletRequest request, String userName)
     {
         User user = null;
         try
@@ -941,8 +934,7 @@
         }
         catch (Exception e)
         {
-            // TODO: logging
-            System.err.println("user not found: " + userName + ", " + e);
+            SecurityUtil.publishErrorMessage(request, SecurityResources.TOPIC_USER, e.getMessage());
         }    
         return user;
     }
@@ -962,7 +954,7 @@
     {
         String userName = (String)PortletMessaging.receive(actionRequest, 
                 SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);
-        User user = lookupUser(userName);
+        User user = lookupUser(actionRequest, userName);
         if (user != null)
         {
             String locatorName = actionRequest.getParameter("locator_name");
@@ -978,9 +970,7 @@
                 }
                 catch (Exception e)
                 {
-                    SecurityUtil.publishErrorMessage(actionRequest,e.getMessage());
-                    // TODO: logging
-                    System.err.println("failed to set rule for principal: " + userName + ", "  + locatorName + e);                       
+                    SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, e.getMessage());
                 }
             }
             
@@ -991,7 +981,7 @@
     {
         String userName = (String)PortletMessaging.receive(actionRequest, 
                 SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);
-        User user = lookupUser(userName);
+        User user = lookupUser(actionRequest, userName);
         if (user != null)
         {
             String[] locatorNames = actionRequest.getParameterValues("user_profile_id");
@@ -1016,9 +1006,7 @@
                     }
                     catch (Exception e)
                     {
-                        SecurityUtil.publishErrorMessage(actionRequest,e.getMessage());
-                        // TODO: logging
-                        System.err.println("failed to remove rule for principal: " + userName + ", "  + locatorNames[ix] + e);                       
+                        SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, e.getMessage());
                     }                
                 }
             }                                    
@@ -1029,10 +1017,14 @@
     {
         String userName = actionRequest.getParameter("jetspeed.user");
         String password = actionRequest.getParameter("jetspeed.password");            
-        if (!SecurityUtil.isEmpty(userName) && !SecurityUtil.isEmpty(password)) 
+        if (!SecurityUtil.isEmpty(userName))
         {
             try
             {            
+                if (SecurityUtil.isEmpty(password))
+                {
+                    throw new SecurityException(SecurityException.PASSWORD_REQUIRED);
+                }
                 userManager.addUser(userName, password);
                 PortletMessaging.publish(actionRequest, SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_REFRESH, "true");
                 PortletMessaging.publish(actionRequest, SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED, userName);
@@ -1078,13 +1070,15 @@
                 {
                     Principal principal = SecurityUtil.getPrincipal(user.getSubject(), UserPrincipal.class);                         
                     profiler.setRuleForPrincipal(principal, profiler.getRule(rule), "page");
-                }
-                
+                }                
+            }
+            catch (SecurityException sex)
+            {
+                SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, sex.getMessage());
             }
-            catch (Exception se)
+            catch (Exception ex)
             {
-                ResourceBundle bundle = ResourceBundle.getBundle("org.apache.jetspeed.portlets.security.resources.UsersResources",actionRequest.getLocale());                
-                SecurityUtil.publishErrorMessage(actionRequest, bundle.getString("user.exists"));
+                SecurityUtil.publishErrorMessage(actionRequest, SecurityResources.TOPIC_USER, ex.getMessage());
             }
         }
     }

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml?rev=354525&r1=354524&r2=354525&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml Tue Dec  6 11:48:58 2005
@@ -446,6 +446,38 @@
         </portlet-info>
     </portlet>
 
+    <portlet id="RoleMultiChooser">
+      <init-param>
+        <description>This parameter sets the template used in view mode.</description>
+        <name>ViewPage</name>
+        <value>/WEB-INF/security/roles/role-multi-chooser.vm</value>
+      </init-param>
+      <portlet-name>RoleMultiChooser</portlet-name>
+      <display-name>Choose Multiple Roles</display-name>
+      <description>Multiple Role Chooser Portlet</description>
+      <portlet-class>org.apache.jetspeed.portlets.security.roles.RoleChooserPortlet</portlet-class>
+      <expiration-cache>-1</expiration-cache>
+      <supports>
+        <mime-type>text/html</mime-type>
+        <portlet-mode>EDIT</portlet-mode>
+        <portlet-mode>VIEW</portlet-mode>
+        <portlet-mode>HELP</portlet-mode>
+      </supports>
+      <supported-locale>en</supported-locale>
+      <resource-bundle>org.apache.jetspeed.portlets.security.resources.SecurityResources</resource-bundle>
+      <portlet-preferences>
+        <preference>
+          <name>WindowSize</name>
+          <value>1000</value>
+        </preference>
+      </portlet-preferences>
+      <portlet-info>
+        <title>Roles Select</title>
+        <short-title>Roles</short-title>
+        <keywords>admin,security,roles</keywords>
+      </portlet-info>
+    </portlet>
+    
     <portlet id="GroupChooser">
         <init-param>
             <description>This parameter sets the template used in view mode.</description>

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/groups/group-details.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/groups/group-details.vm?rev=354525&r1=354524&r2=354525&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/groups/group-details.vm (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/groups/group-details.vm Tue Dec  6 11:48:58 2005
@@ -20,13 +20,24 @@
 @version $Id: group-details.vm 348264 2005-11-22 22:06:45Z taylor $
 
 *#
+#if ($groupTab == "users")
+#set ($target = "user")
+#set ($Target = "User")
+#set ($targets = "users")
+#set ($Targets = "Users")
+#else
+#set ($target = "role")
+#set ($Target = "Role")
+#set ($targets = "roles")
+#set ($Targets = "Roles")
+#end
 
 <script>
 function openWindow(pipeline)
-{	
-    var vWinUsers = window.open(pipeline, 'UserPicker', 'status=no,resizable=yes,width=200,height=300,scrollbars=yes');
-    vWinUsers.opener = self;
-	vWinUsers.focus();
+{ 
+    var vWin = window.open(pipeline, "${Target}Picker", 'status=no,resizable=yes,width=200,height=300,scrollbars=yes');
+    vWin.opener = self;
+  vWin.focus();
 }
 </script>
 
@@ -36,6 +47,9 @@
 #if ($statusMsg)
 #parse ('/WEB-INF/view/status-include.vm')
 #end
+#if ($errorMessages)
+#parse ('/WEB-INF/view/errors-include.vm')
+#end
 #if ($group)
 #set ($newGroup = "false")
 #else
@@ -43,13 +57,14 @@
 #end
 
 <form name='groupForm' action="$formAction" method="post">
+<input type="hidden" name="groupTab" value="$groupTab"/>
 <table>
   <tr colspan="2" align="right">
     <td nowrap class="portlet-section-alternate" align="right">$MESSAGES.getString('groupname')&nbsp;</td>
     <td class="portlet-section-body" align="left">
       <input type="text" name='group' size="40" value="$!group" 
        class="portlet-form-field-label"
-      #if ($newGroup == "false") readonly #end
+#if ($newGroup == "false") readonly #end
       >
     </td>
   </tr>
@@ -58,51 +73,73 @@
 #if ($newGroup == "true")
 <input type="submit" name="group.action.Save" value="$MESSAGES.getString('save')" class="portlet-form-button"/>
 #end
-</form>	      
+</form>       
 
 #if ($newGroup == "false")
-<form name='usersInGroupForm' action="$formAction" method="post">
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+  <tr>
+#set ($tabTarget = $renderResponse.createActionURL()) 
+#if ($groupTab == "users")
+    $tabTarget.setParameter("switchTab", "roles")
+    <td class="LTabLeft" style="font-size:1pt;" nowrap="true">&nbsp;</td>
+    <td class="LTab" align="center" style="vertical-align:middle">$MESSAGES.getString('users')</td>
+    <td class="LTabRight" style="font-size:1pt;" nowrap="true">&nbsp;</td>
+    <td class="LTabLeftLow" style="font-size:1pt;" nowrap="true">&nbsp;</td>
+    <td class="LTabLow" align="center" style="vertical-align:middle"><a href="$tabTarget">$MESSAGES.getString('roles')</a></td>
+    <td class="LTabRightLow" style="font-size:1pt;" nowrap="true">&nbsp;</td>
+#else
+    $tabTarget.setParameter("switchTab", "users")
+    <td class="LTabLeftLow" style="font-size:1pt;" nowrap="true">&nbsp;</td>
+    <td class="LTabLow" align="center" style="vertical-align:middle"><a href="$tabTarget">$MESSAGES.getString('users')</a></td>
+    <td class="LTabRightLow" style="font-size:1pt;" nowrap="true">&nbsp;</td>
+    <td class="LTabLeft" style="font-size:1pt;" nowrap="true">&nbsp;</td>
+    <td class="LTab" align="center" style="vertical-align:middle">$MESSAGES.getString('roles')</td>
+    <td class="LTabRight" style="font-size:1pt;" nowrap="true">&nbsp;</td>
+#end
+  </tr>
+</table>
+<br/>
+<form name="${targets}InGroupForm" action="$formAction" method="post">
+<input type="hidden" name="groupTab" value="$groupTab"/>
 <table cellpadding=0 cellspacing=1 border=0 width='100%' >
-#if ($tableSize > 0)
-   <input type="hidden" name="group" value="$!group">
-   <input type="submit" id="removeCheckedUsers" name="group.action.Remove_Checked_Users" value="$MESSAGES.getString('removecheckedusers')" style="display:none"/>
+  <input type="hidden" name="group" value="$!group">
+  <input type="submit" id="removeChecked$Targets" name="group.action.Remove_Checked_$Targets" value='$MESSAGES.getString("removechecked$targets")' style="display:none"/>
   <tr>
-    #foreach ($column in $title)      
+#foreach ($column in $title)      
      <th width="10"></th>
       <th align='center' class="portlet-section-header" nowrap>
-        $column
+        $MESSAGES.getString("$column")
       </th>
-    #end
+#end
   </tr>
-#end  
-  #foreach ( $user in $table )
+#foreach ( $entry in $table )
   <tr>
-    #if ($velocityCount % 2 == 0)
-       #set($rowstyle = "portlet-section-body")
-    #else
-       #set($rowstyle = "portlet-section-alternate")
-    #end  
+#if ($velocityCount % 2 == 0)
+#set($rowstyle = "portlet-section-body")
+#else
+#set($rowstyle = "portlet-section-alternate")
+#end  
     <td class="$rowstyle" width="10">
-        <input type="checkbox" name="box_$user"/>
+        <input type="checkbox" name="box_$entry"/>
+    </td>
+    <td class="$rowstyle" nowrap>
+      <div align="center">$entry</div>
     </td>
-	  <td class="$rowstyle" nowrap>
-	    <div align="center">$user</div>
-	  </td>
    </tr>
-  #end
+#end
 </table>
 </form>
 
-#if ($tableSize > 0)
 <hr/>
 
 <!-- controls -->
 <table width="200" border="0" cellspacing="0" cellpadding="0" align="center">
   <tr>
-    #if ($prev)
+#if ($prev)
       <td valign="middle" height="30">
         <div align="center">
           <form action="$formAction" method="post">
+            <input type="hidden" name="groupTab" value="$groupTab"/>
             <input type='hidden' name='db.browser.action' value='first' />                    
             <input class="portlet-form-button" type="submit" value="$MESSAGES.getString('firstArrow')">
             <input type="hidden" name="start" value="0">
@@ -112,15 +149,17 @@
       <td valign="middle" height="30">
         <div align="center">
           <form action="$renderResponse.createActionURL()" method="post">
+            <input type="hidden" name="groupTab" value="$groupTab"/>
             <input type='hidden' name='db.browser.action' value='prev'/>                    
             <input class="portlet-form-button" type="submit" value="$MESSAGES.getString('prevArrow')">
             <input type="hidden" name="start" value="$prev">
           </form>
         </div>
       </td>
-    #end
-    #if ($tableSize > 0)
+#end
+#if ($tableSize > 0)
       <form action="$formAction" method="post">
+      <input type="hidden" name="groupTab" value="$groupTab"/>
       <td valign="middle" height="30">
         <div align="center">
             <input type='hidden' name='db.browser.action' value='change'/>                    
@@ -140,11 +179,12 @@
 
       </form>
       
-    #end    
-    #if ($next)
+#end    
+#if ($next)
       <td valign="middle">
         <div align="center">
           <form action="$formAction" method="post">
+            <input type="hidden" name="groupTab" value="$groupTab"/>
             <input type='hidden' name='db.browser.action' value='next'/>          
             <input class="portlet-form-button" type="submit" value="$MESSAGES.getString('nextArrow')">
             <input type="hidden" name="start" value="$next">
@@ -154,26 +194,29 @@
       <td valign="middle" height="30">
         <div align="center">
           <form action="$formAction" method="post">
+            <input type="hidden" name="groupTab" value="$groupTab"/>
             <input type='hidden' name='db.browser.action' value='last'/>                    
             <input class="portlet-form-button" type="submit" value="$MESSAGES.getString('lastArrow')">
             <input type="hidden" name="start" value="$tableSize">
           </form>
         </div>
       </td>  
-    #end
-    #if ($tableSize > 0)
+#end
+#if ($tableSize > 0)
       <td valign="middle">
         <div align="center">
           <form action="$formAction" method="post">
+            <input type="hidden" name="groupTab" value="$groupTab"/>
             <input type='hidden' name='db.browser.action' value='refresh'/>
             <input class="portlet-form-button" type="submit" name="eventSubmit_doRefresh" value="$MESSAGES.getString('refresh')" />
           </form>
         </div>
       </td>
-    #end
+#end
   </tr>
 </table>
 <form action="$formAction" method="post">
+    <input type="hidden" name="groupTab" value="$groupTab"/>
     <input type='hidden' name='db.browser.action' value='search'/>                    
     <input type='hidden' name='searchColumn' value='1'/>                        
     
@@ -186,20 +229,21 @@
   </tr>
   </table>    
 </form>
-#end
+
 
 <form name="securityform" action="$formAction" method="post">
+<input type="hidden" name="groupTab" value="$groupTab"/>
 <table>
 <tr>
   <td>
    <input type="submit" name="group.action.Add_New_Group" value="$MESSAGES.getString('addNewGroup')" class="portlet-form-button"  />
   </td>
   <td>
-   <input onclick="javascript:openWindow('$userChooser')" type="button" name="group.action.Add_Users_To_Group" value="$MESSAGES.getString('adduserstogroup')" class="portlet-form-button"  />
+   <input onclick="javascript:openWindow('$popupChooser')" type="button" name="group.action.Add_${Targets}_To_Group" value='$MESSAGES.getString("add${targets}togroup")' class="portlet-form-button"  />
   </td>  
 #if ($tableSize > 0)  
   <td>
-   <input type="button" onclick="javascript:document.forms.usersInGroupForm.removeCheckedUsers.click()" value="$MESSAGES.getString('removecheckedusers')" class="portlet-form-button" />
+   <input type="button" onclick="javascript:document.forms.${targets}InGroupForm.removeChecked${Targets}.click()" value='$MESSAGES.getString("removechecked$targets")' class="portlet-form-button" />
   </td>    
 #end
   <td>
@@ -207,11 +251,8 @@
   </td>  
 </tr>
 </table>
-<input type='hidden' name='users'/>
+<input type='hidden' name="${targets}"/>
 <input type='hidden' name='group' value='$group'/>
 
 </form>
-
-
 #end
-

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/groups/groups-view.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/groups/groups-view.vm?rev=354525&r1=354524&r2=354525&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/groups/groups-view.vm (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/groups/groups-view.vm Tue Dec  6 11:48:58 2005
@@ -6,13 +6,16 @@
 #if ($statusMsg)
 #parse ('/WEB-INF/view/status-include.vm')
 #end
+#if ($errorMessages)
+#parse ('/WEB-INF/view/errors-include.vm')
+#end
 
 <table cellpadding=0 cellspacing=1 border=0 width='100%' >
   <tr>
      <th width='12'></th>
     #foreach ($column in $title)      
       <th align='center' class="portlet-section-header" width="100%" nowrap>
-        $column
+        $MESSAGES.getString("$column")
       </th>
     #end
   </tr>



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org