taylor      2005/04/22 13:42:09

  Modified:    
applications/security/src/java/org/apache/jetspeed/portlets/security/users
                        UserDetailsPortlet.java UserBrowserPortlet.java
                        UserBrowser.java UserChooserPortlet.java
               
applications/security/src/java/org/apache/jetspeed/portlets/security/resources
                        UsersResources_ja.properties
                        UsersResources.properties
                        UsersResources_it.properties
                        UsersResources_en.properties
                        UsersResources_nl.properties
               
applications/security/src/java/org/apache/jetspeed/portlets/security/roles
                        RoleBrowser.java
               applications/security/src/webapp/WEB-INF/security/users
                        user-details.jsp
               
applications/security/src/java/org/apache/jetspeed/portlets/security
                        SecurityResources.java
               
applications/security/src/java/org/apache/jetspeed/portlets/security/groups
                        GroupBrowser.java
  Added:       
applications/security/src/java/org/apache/jetspeed/portlets/security/resources
                        UsersResources_fr.properties
               
applications/security/src/java/org/apache/jetspeed/portlets/security
                        SecurityUtil.java
  Removed:     
applications/security/src/java/org/apache/jetspeed/portlets/security
                        AbstractSecurityBrowser.java
  Log:
  http://issues.apache.org/jira/browse/JS2-237
  new user administration minimal feature set completed
  This is a very minimalistic set of features
  Ate will be updating JS2-237 with the full set of feature requirements
  Next: Roles, Groups
  
  Revision  Changes    Path
  1.6       +98 -55    
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserDetailsPortlet.java
  
  Index: UserDetailsPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserDetailsPortlet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- UserDetailsPortlet.java   22 Apr 2005 05:46:58 -0000      1.5
  +++ UserDetailsPortlet.java   22 Apr 2005 20:42:09 -0000      1.6
  @@ -38,6 +38,7 @@
   import javax.security.auth.Subject;
   
   import org.apache.jetspeed.portlets.security.SecurityResources;
  +import org.apache.jetspeed.portlets.security.SecurityUtil;
   import org.apache.jetspeed.portlets.security.users.JetspeedUserBean;
   import 
org.apache.jetspeed.portlets.security.users.JetspeedUserBean.StringAttribute;
   import org.apache.jetspeed.profiler.Profiler;
  @@ -96,6 +97,10 @@
       
       /** the id of the roles control */
       private static final String ROLES_CONTROL = "jetspeedRoles";
  +    
  +    /** the id of the rules control */
  +    private static final String RULES_CONTROL = "jetspeedRules";
  +    
   
       /** the id of the groups control */
       private static final String GROUPS_CONTROL = "jetspeedGroups";
  @@ -160,7 +165,7 @@
           response.setContentType("text/html");
           
           String userName = (String)PortletMessaging.receive(request, 
  -                                UserBrowser.TOPIC_USERS, 
UserBrowser.MESSAGE_SELECTED);
  +                                SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_SELECTED);
   
           User user = null;
           if (userName != null)
  @@ -202,7 +207,7 @@
                   request.setAttribute(VIEW_ROLES, userRoles );
                   
                   // check for refresh on roles list
  -                String refreshRoles = 
(String)PortletMessaging.consume(request, SecurityResources.USER_BROWSER, 
"roles");
  +                String refreshRoles = 
(String)PortletMessaging.consume(request, SecurityResources.TOPIC_USERS, 
"roles");
                   List roles = null;
                   if (refreshRoles == null)
                   {        
  @@ -248,7 +253,7 @@
                   request.setAttribute(VIEW_GROUPS, userGroups);
                   
                   // check for refresh on groups list
  -                String refreshGroups = 
(String)PortletMessaging.consume(request, SecurityResources.USER_BROWSER, 
"groups");
  +                String refreshGroups = 
(String)PortletMessaging.consume(request, SecurityResources.TOPIC_USERS, 
"groups");
                   List groups = null;
                   if (refreshGroups == null)
                   {        
  @@ -300,7 +305,11 @@
              
               request.setAttribute(SecurityResources.REQUEST_SELECT_TAB, 
selectedTab);
           }
  -
  +        else
  +        {
  +            renderRoleInformation(request);
  +            renderProfileInformation(request);            
  +        }
           // check for ErrorMessages
           ArrayList errorMessages = 
(ArrayList)PortletMessaging.consume(request, ERROR_MESSAGES);
           if (errorMessages != null )
  @@ -311,6 +320,59 @@
           super.doView(request, response);
       }
   
  +    protected void renderRoleInformation(RenderRequest request)
  +    throws PortletException
  +    {
  +        // check for refresh on roles list
  +        String refreshRoles = (String)PortletMessaging.consume(request, 
SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_REFRESH_ROLES);
  +        List roles = null;
  +        if (refreshRoles == null)
  +        {        
  +            roles = (List) 
request.getPortletSession().getAttribute(ROLES_CONTROL);
  +        }
  +        
  +        // build the roles control and provide it to the view
  +        try
  +        {
  +            if (roles == null)
  +            {
  +                roles = new LinkedList();
  +                Iterator fullRoles = roleManager.getRoles("");
  +                while (fullRoles.hasNext())
  +                {
  +                    Role role = (Role)fullRoles.next();
  +                    roles.add(role.getPrincipal().getName());
  +                }
  +                request.getPortletSession().setAttribute(ROLES_CONTROL, 
roles);
  +            }
  +        }
  +        catch (SecurityException se)
  +        {
  +            throw new PortletException(se);
  +        }        
  +        request.setAttribute(ROLES_CONTROL, roles);        
  +    }
  +    
  +    protected void renderProfileInformation(RenderRequest request)
  +    {
  +        // check for refresh on profiles list
  +        String refreshProfiles = (String)PortletMessaging.consume(request, 
  +                        SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_REFRESH_PROFILES);
  +        Collection rules = null;
  +        if (refreshProfiles == null)
  +        {        
  +            rules = (Collection) 
request.getPortletSession().getAttribute(RULES_CONTROL);
  +        }
  +        
  +        // build the profiles control and provide it to the view
  +        if (rules == null)
  +        {
  +            rules = profiler.getRules();
  +            request.getPortletSession().setAttribute(RULES_CONTROL, rules);
  +        }
  +        request.setAttribute(RULES_CONTROL, rules);        
  +    }
  +    
       public void processAction(ActionRequest actionRequest, ActionResponse 
actionResponse) 
           throws PortletException, IOException
       {   
  @@ -331,7 +393,7 @@
           }
           else if (action != null && action.equals("add.new.user"))
           {
  -            PortletMessaging.cancel(actionRequest, UserBrowser.TOPIC_USERS, 
UserBrowser.MESSAGE_SELECTED);
  +            PortletMessaging.cancel(actionRequest, 
SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);
           }
           else if (action != null && action.equals("add.user"))
           {
  @@ -406,14 +468,14 @@
       throws PortletException
       {
           String userName = (String)PortletMessaging.receive(actionRequest, 
  -                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);      
  
  +                SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_SELECTED);        
           User user = lookupUser(userName);
           if (user != null)
           {
               try
               {
                   userManager.removeUser(userName);
  -                PortletMessaging.publish(actionRequest, "users", "refresh", 
"all");
  +                PortletMessaging.publish(actionRequest, 
SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_REFRESH, "true");
               }
               catch (Exception e)
               {
  @@ -443,7 +505,7 @@
           ResourceBundle bundle = 
ResourceBundle.getBundle("org.apache.jetspeed.portlets.security.resources.UsersResources",actionRequest.getLocale());
   
           String userName = (String)PortletMessaging.receive(actionRequest, 
  -                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
  +                SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -503,7 +565,7 @@
       private void updateUserAttribute(ActionRequest actionRequest, 
ActionResponse actionResponse)
       {
           String userName = (String)PortletMessaging.receive(actionRequest, 
  -                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
  +                SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -523,7 +585,7 @@
       private void addUserAttribute(ActionRequest actionRequest, 
ActionResponse actionResponse)
       {
           String userName = (String)PortletMessaging.receive(actionRequest, 
  -                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);      
  
  +                SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_SELECTED);        
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -540,7 +602,7 @@
       private void removeUserAttributes(ActionRequest actionRequest, 
ActionResponse actionResponse)
       {
           String userName = (String)PortletMessaging.receive(actionRequest, 
  -                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);      
  
  +                SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_SELECTED);        
           List deletes = new LinkedList();
           
           User user = lookupUser(userName);
  @@ -580,7 +642,7 @@
       private void removeUserRoles(ActionRequest actionRequest, ActionResponse 
actionResponse)
       {
           String userName = (String)PortletMessaging.receive(actionRequest, 
  -                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
  +                SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -611,7 +673,7 @@
       private void addUserRole(ActionRequest actionRequest, ActionResponse 
actionResponse)
       {
           String userName = (String)PortletMessaging.receive(actionRequest, 
  -                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);      
 
  +                SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_SELECTED);       
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -635,7 +697,7 @@
       private void removeUserGroups(ActionRequest actionRequest, 
ActionResponse actionResponse)
       {
           String userName = (String)PortletMessaging.receive(actionRequest, 
  -                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
  +                SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -666,7 +728,7 @@
       private void addUserGroup(ActionRequest actionRequest, ActionResponse 
actionResponse)
       {
           String userName = (String)PortletMessaging.receive(actionRequest, 
  -                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
  +                SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -771,7 +833,7 @@
       private void addUserProfile(ActionRequest actionRequest, ActionResponse 
actionResponse)
       {
           String userName = (String)PortletMessaging.receive(actionRequest, 
  -                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
  +                SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -800,7 +862,7 @@
       private void removeUserProfile(ActionRequest actionRequest, 
ActionResponse actionResponse)
       {
           String userName = (String)PortletMessaging.receive(actionRequest, 
  -                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
  +                SecurityResources.TOPIC_USERS, 
SecurityResources.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -839,54 +901,35 @@
       {
           String userName = actionRequest.getParameter("jetspeed.user");
           String password = actionRequest.getParameter("jetspeed.password");   
         
  -        if (!isEmpty(userName) && !isEmpty(password)) 
  +        if (!SecurityUtil.isEmpty(userName) && 
!SecurityUtil.isEmpty(password)) 
           {
               try
               {            
                   userManager.addUser(userName, password);
  -                PortletMessaging.publish(actionRequest, 
UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_REFRESH, "true");
  -                
  -                
  -//                User user = userManager.getUser(userName);
  -//                String role = actionRequest.getParameter(ROLES_CONTROL);
  -//                if (!isEmpty(role) && user != null) 
  -//                {
  -//                    roleManager.addRoleToUser(userName, role);
  -//                }
  -//
  -//                String rule = actionRequest.getParameter(RULES_CONTROL);
  -//                if (!isEmpty(rule) && user != null) 
  -//                {
  -//                    Principal principal = getPrincipal(user.getSubject(), 
UserPrincipal.class);                         
  -//                    profiler.setRuleForPrincipal(principal, 
profiler.getRule(rule), "page");
  -//                }
  -                
  -            }
  -            catch (Exception se)
  -            {
  -                try
  +                PortletMessaging.publish(actionRequest, 
SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_REFRESH, "true");
  +                                
  +                User user = userManager.getUser(userName);
  +                String role = actionRequest.getParameter(ROLES_CONTROL);
  +                if (!SecurityUtil.isEmpty(role) && user != null) 
                   {
  -                    PortletMessaging.publish(actionRequest, "user.error", 
se.getMessage());
  +                    roleManager.addRoleToUser(userName, role);
                   }
  -                catch (Exception e)
  +
  +                String rule = actionRequest.getParameter(RULES_CONTROL);
  +                if (!SecurityUtil.isEmpty(rule) && user != null) 
                   {
  +                    Principal principal = 
SecurityUtil.getPrincipal(user.getSubject(), UserPrincipal.class);              
           
  +                    profiler.setRuleForPrincipal(principal, 
profiler.getRule(rule), "page");
                   }
  +                
  +            }
  +            catch (Exception se)
  +            {
  +                ResourceBundle bundle = 
ResourceBundle.getBundle("org.apache.jetspeed.portlets.security.resources.UsersResources",actionRequest.getLocale());
                
  +                publishErrorMessage(actionRequest, 
bundle.getString("user.exists"));
               }
  -            
           }
  -                    
  -        
  -        return;
  -        
       }
       
  -    private boolean isEmpty(String s)
  -    {
  -        if (s == null) return true;
  -        
  -        if (s.trim().equals("")) return true;
  -        
  -        return false;
  -    }
       
   }
  
  
  
  1.3       +4 -2      
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserBrowserPortlet.java
  
  Index: UserBrowserPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserBrowserPortlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UserBrowserPortlet.java   22 Dec 2004 22:59:40 -0000      1.2
  +++ UserBrowserPortlet.java   22 Apr 2005 20:42:09 -0000      1.3
  @@ -47,7 +47,9 @@
   
   /**
    * This portlet is a browser over all the portlet applications in the system.
  - * 
  + *
  + * @deprecated 
  + * @see UserBrowser.java (new implementation)
    * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor </a>
    * @version $Id$
    */
  
  
  
  1.2       +17 -17    
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserBrowser.java
  
  Index: UserBrowser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserBrowser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UserBrowser.java  22 Apr 2005 05:46:58 -0000      1.1
  +++ UserBrowser.java  22 Apr 2005 20:42:09 -0000      1.2
  @@ -29,12 +29,13 @@
   import javax.portlet.RenderRequest;
   import javax.portlet.RenderResponse;
   
  -import org.apache.jetspeed.portlets.security.AbstractSecurityBrowser;
  +import org.apache.jetspeed.portlets.security.SecurityUtil;
   import org.apache.jetspeed.portlets.security.SecurityResources;
   import org.apache.jetspeed.security.User;
   import org.apache.jetspeed.security.UserManager;
   import org.apache.jetspeed.security.UserPrincipal;
   import org.apache.portals.gems.browser.BrowserIterator;
  +import org.apache.portals.gems.browser.BrowserPortlet;
   import org.apache.portals.gems.browser.DatabaseBrowserIterator;
   import org.apache.portals.gems.util.StatusMessage;
   import org.apache.portals.messaging.PortletMessaging;
  @@ -46,15 +47,14 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
    * @version $Id$
    */
  -public class UserBrowser extends AbstractSecurityBrowser
  +public class UserBrowser extends BrowserPortlet
   {
  -    private UserManager userManager;
  -    
  -    public static final String TOPIC_USERS = "UserBrowser";
  -    public static final String MESSAGE_SELECTED = "selected";
  -    public static final String MESSAGE_STATUS = "status";
  -    public static final String MESSAGE_REFRESH = "refresh";
  -        
  +    protected UserManager userManager;
  +
  +    // view context
  +    public static final String STATUS = "statusMsg";
  +    public static final String SELECTED = "selected";
  +
       public void init(PortletConfig config)
       throws PortletException 
       {
  @@ -70,26 +70,26 @@
       public void doView(RenderRequest request, RenderResponse response)
       throws PortletException, IOException
       {
  -        String selected = (String)PortletMessaging.receive(request, 
TOPIC_USERS, MESSAGE_SELECTED);
  +        String selected = (String)PortletMessaging.receive(request, 
SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED);
           if (selected != null)
           {        
               Context context = this.getContext(request);
               context.put(SELECTED, selected);
           }
  -        StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, 
TOPIC_USERS, MESSAGE_STATUS);
  +        StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, 
SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_STATUS);
           if (msg != null)
           {
               this.getContext(request).put(STATUS, msg);            
           }
  -        String refresh = (String)PortletMessaging.consume(request, 
TOPIC_USERS, MESSAGE_REFRESH); 
  +        String refresh = (String)PortletMessaging.consume(request, 
SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_REFRESH); 
           if (refresh != null)
           {        
               this.clearBrowserIterator(request);
  -        }
  +        }                
           
           super.doView(request, response);
       }
  -    
  +        
       public void processAction(ActionRequest request, ActionResponse response)
       throws PortletException, IOException
       {
  @@ -98,7 +98,7 @@
               String selected = request.getParameter("user");
               if (selected != null)
               {
  -                PortletMessaging.publish(request, TOPIC_USERS, 
MESSAGE_SELECTED, selected);
  +                PortletMessaging.publish(request, 
SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED, selected);
               }
           }
           super.processAction(request, response);
  @@ -124,7 +124,7 @@
               while (users.hasNext())
               {
                   User user = (User)users.next();
  -                Principal principal = getPrincipal(user.getSubject(),
  +                Principal principal = 
SecurityUtil.getPrincipal(user.getSubject(),
                           UserPrincipal.class);                
                   list.add(principal.getName());
               }            
  
  
  
  1.4       +3 -3      
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserChooserPortlet.java
  
  Index: UserChooserPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserChooserPortlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UserChooserPortlet.java   22 Apr 2005 05:46:58 -0000      1.3
  +++ UserChooserPortlet.java   22 Apr 2005 20:42:09 -0000      1.4
  @@ -25,7 +25,7 @@
   import javax.portlet.RenderRequest;
   import javax.security.auth.Subject;
   
  -import org.apache.jetspeed.portlets.security.AbstractSecurityBrowser;
  +import org.apache.jetspeed.portlets.security.SecurityUtil;
   import org.apache.jetspeed.portlets.security.SecurityResources;
   import org.apache.jetspeed.security.User;
   import org.apache.jetspeed.security.UserManager;
  @@ -40,7 +40,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
    * @version $Id$
    */
  -public class UserChooserPortlet extends AbstractSecurityBrowser
  +public class UserChooserPortlet extends SecurityUtil
   {
       private UserManager userManager;
       
  
  
  
  1.2       +3 -1      
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/UsersResources_ja.properties
  
  Index: UsersResources_ja.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/UsersResources_ja.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UsersResources_ja.properties      17 Feb 2005 21:34:59 -0000      1.1
  +++ UsersResources_ja.properties      22 Apr 2005 20:42:09 -0000      1.2
  @@ -19,3 +19,5 @@
   
chgpwd.error.invalidPassword=\u73fe\u5728\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u4e0d\u6b63\u3067\u3059
   
chgpwd.error.invalidNewPassword=\u65b0\u3057\u3044\u30d1\u30b9\u30ef\u30fc\u30c9\u306f\u4e0d\u6b63\u3067\u3059
   
chgpwd.error.passwordAlreadyUsed=\u305d\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u306f\u65e2\u306b\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059
  +user.exists = User already exists, cannot add new user
  +
  
  
  
  1.2       +2 -1      
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/UsersResources.properties
  
  Index: UsersResources.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/UsersResources.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UsersResources.properties 3 Feb 2005 01:30:54 -0000       1.1
  +++ UsersResources.properties 22 Apr 2005 20:42:09 -0000      1.2
  @@ -19,3 +19,4 @@
   chgpwd.error.invalidPassword=Current password invalid
   chgpwd.error.invalidNewPassword=Invalid new password
   chgpwd.error.passwordAlreadyUsed=Password already used
  +user.exists = User already exists, cannot add new user
  
  
  
  1.2       +25 -24    
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/UsersResources_it.properties
  
  Index: UsersResources_it.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/UsersResources_it.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UsersResources_it.properties      3 Apr 2005 22:26:58 -0000       1.1
  +++ UsersResources_it.properties      22 Apr 2005 20:42:09 -0000      1.2
  @@ -1,24 +1,25 @@
  -# Copyright 2004 The 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.
  -#
  -#    Please contact me if you have any questions or suggestion : [EMAIL 
PROTECTED]
  -#
  -#    Italian version by Dessì Massimiliano  <a href="[EMAIL 
PROTECTED]">[EMAIL PROTECTED]</a>.
  -#    Vers 0.1 jetspeed 2.0   03/04/2005
  -
  -
  -## change password
  -chgpwd.error.invalidPassword=password attuale non valida
  -chgpwd.error.invalidNewPassword=Nuova password non valida
  -chgpwd.error.passwordAlreadyUsed=Password gia' in uso
  \ No newline at end of file
  +# Copyright 2004 The 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.
  +#
  +#    Please contact me if you have any questions or suggestion : [EMAIL 
PROTECTED]
  +#
  +#    Italian version by Dessì Massimiliano  <a href="[EMAIL 
PROTECTED]">[EMAIL PROTECTED]</a>.
  +#    Vers 0.1 jetspeed 2.0   03/04/2005
  +
  +
  +## change password
  +chgpwd.error.invalidPassword=password attuale non valida
  +chgpwd.error.invalidNewPassword=Nuova password non valida
  +chgpwd.error.passwordAlreadyUsed=Password gia' in uso
  +user.exists = User nome in uso
  
  
  
  1.3       +2 -1      
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/UsersResources_en.properties
  
  Index: UsersResources_en.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/UsersResources_en.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UsersResources_en.properties      20 Feb 2005 23:00:25 -0000      1.2
  +++ UsersResources_en.properties      22 Apr 2005 20:42:09 -0000      1.3
  @@ -21,3 +21,4 @@
   chgpwd.error.invalidPassword=Current password invalid
   chgpwd.error.invalidNewPassword=Invalid new password
   chgpwd.error.passwordAlreadyUsed=Password already used
  +user.exists = User already exists, cannot add new user
  
  
  
  1.2       +2 -1      
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/UsersResources_nl.properties
  
  Index: UsersResources_nl.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/UsersResources_nl.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UsersResources_nl.properties      3 Feb 2005 01:30:54 -0000       1.1
  +++ UsersResources_nl.properties      22 Apr 2005 20:42:09 -0000      1.2
  @@ -19,3 +19,4 @@
   chgpwd.error.invalidPassword=Huidig wachtwoord ongeldig
   chgpwd.error.invalidNewPassword=Ongeldig nieuw wachtwoord
   chgpwd.error.passwordAlreadyUsed=Wachtwoord reeds eerder gebruikt
  +user.exists = L'utente già esiste, non può aggiungere il nuovo utente
  
  
  
  1.1                  
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/UsersResources_fr.properties
  
  Index: UsersResources_fr.properties
  ===================================================================
  # Copyright 2004 The 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.
  #
  # $Id: UsersResources_fr.properties,v 1.1 2005/04/22 20:42:09 taylor Exp $
  #
  # LOCALIZATION MAINTAINER:
  #  Jetspeed Development Team
  
  ## change password
  chgpwd.error.invalidPassword=Password courant inadmissible
  chgpwd.error.invalidNewPassword=Nouveau password inadmissible
  chgpwd.error.passwordAlreadyUsed=Password a déjà employé
  user.exists = User déjà existe, ne peut pas ajouter le nouvel user
  
  
  
  1.3       +3 -3      
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/roles/RoleBrowser.java
  
  Index: RoleBrowser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/roles/RoleBrowser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RoleBrowser.java  27 Mar 2005 23:33:17 -0000      1.2
  +++ RoleBrowser.java  22 Apr 2005 20:42:09 -0000      1.3
  @@ -154,7 +154,7 @@
                           roleManager.removeRole(delete);
                           this.clearBrowserIterator(request);
                           PortletMessaging.cancel(request, "role", "selected");
  -                        PortletMessaging.publish(request, 
SecurityResources.USER_BROWSER, "roles", "refresh");
  +                        PortletMessaging.publish(request, 
SecurityResources.TOPIC_USERS, "roles", "refresh");
                       }
                   }
                   catch (Exception e)
  @@ -194,7 +194,7 @@
                               roleManager.addRole(roleName);
                               this.clearBrowserIterator(request);
                           }
  -                        PortletMessaging.publish(request, 
SecurityResources.USER_BROWSER, "roles", "refresh");
  +                        PortletMessaging.publish(request, 
SecurityResources.TOPIC_USERS, "roles", "refresh");
                       }
                       catch (Exception e)
                       {
  
  
  
  1.10      +10 -2     
jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/security/users/user-details.jsp
  
  Index: user-details.jsp
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/security/users/user-details.jsp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- user-details.jsp  22 Apr 2005 05:46:58 -0000      1.9
  +++ user-details.jsp  22 Apr 2005 20:42:09 -0000      1.10
  @@ -426,10 +426,18 @@
   <%-- Add New User --%>
   <c:if test="${user == null}">
   
  -<h3 class="portlet-section-subheader">Add User</h3>
  +<h3 class="portlet-section-header">Add User</h3>
  +
  +  <c:if test="${errorMessages != null}">
  +    <ul>
  +    <c:forEach items="${errorMessages}" var="error">
  +      <li style="color:red"><c:out value="${error}"/></li>
  +    </c:forEach>
  +    </ul>
  +  </c:if>
  +
   <div class="portlet-section-text">
   <portlet:actionURL var="addUser" />
  -
   <form action="<c:out value="${addUser}"/>" method="post">
   <input type='hidden' name='portlet_action' value='add.user'/>
   <table>
  
  
  
  1.4       +16 -3     
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/SecurityResources.java
  
  Index: SecurityResources.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/SecurityResources.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SecurityResources.java    27 Mar 2005 23:33:17 -0000      1.3
  +++ SecurityResources.java    22 Apr 2005 20:42:09 -0000      1.4
  @@ -42,11 +42,24 @@
       public final static String REQUEST_SELECT_TAB = "selected_tab";
       public final static String PORTLET_ACTION = "portlet_action";
       
  -    // UserDetailsPortlet message topic
  -    public final static String USER_BROWSER = "user_browser";
  +    // Message Topics
  +    public final static String TOPIC_USERS = "users";
  +    public final static String TOPIC_GROUPS = "groups";
  +    public final static String TOPIC_ROLES = "roles";
  +    public final static String TOPIC_PROFILES = "profiles";
   
  +    /** Messages **/
  +    public static final String MESSAGE_SELECTED = "selected";
  +    public static final String MESSAGE_STATUS = "status";
  +    public static final String MESSAGE_REFRESH = "refresh";
  +    public static final String MESSAGE_REFRESH_PROFILES = "refresh.profiles";
  +    public static final String MESSAGE_REFRESH_ROLES = "refresh.roles";
  +    public static final String MESSAGE_REFRESH_GROUPS = "refresh.groups";
  +    
  +    
       /** the selected non-leaf node in the tree view */
       public final static String REQUEST_NODE = "node";
       /** the selected leaf node in the tree view */
       public final static String REQUEST_SELECT_NODE = "select_node";
  +       
   }
  
  
  
  1.1                  
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/SecurityUtil.java
  
  Index: SecurityUtil.java
  ===================================================================
  /* 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;
  
  import java.security.Principal;
  import java.util.Iterator;
  
  import javax.security.auth.Subject;
  
  import org.apache.portals.gems.browser.BrowserPortlet;
  
  
  /**
   * Abstract Security Browser - factored out common functionality for security 
browsers 
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
   * @version $Id: SecurityUtil.java,v 1.1 2005/04/22 20:42:09 taylor Exp $
   */
  public abstract class SecurityUtil extends BrowserPortlet
  {    
          
      public static Principal getPrincipal(Subject subject, Class classe)
      {
          Principal principal = null;
          Iterator principals = subject.getPrincipals().iterator();
          while (principals.hasNext())
          {
              Principal p = (Principal) principals.next();
              if (classe.isInstance(p))
              {
                  principal = p;
                  break;
              }
          }
          return principal;
      }
  
      public static boolean isEmpty(String s)
      {
          if (s == null) return true;
          
          if (s.trim().equals("")) return true;
          
          return false;
      }
      
  }
  
  
  
  1.3       +3 -3      
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/groups/GroupBrowser.java
  
  Index: GroupBrowser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/groups/GroupBrowser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GroupBrowser.java 27 Mar 2005 23:33:17 -0000      1.2
  +++ GroupBrowser.java 22 Apr 2005 20:42:09 -0000      1.3
  @@ -154,7 +154,7 @@
                           groupManager.removeGroup(delete);
                           this.clearBrowserIterator(request);
                           PortletMessaging.cancel(request, "group", 
"selected");
  -                        PortletMessaging.publish(request, 
SecurityResources.USER_BROWSER, "groups", "refresh");
  +                        PortletMessaging.publish(request, 
SecurityResources.TOPIC_USERS, "groups", "refresh");
                       }
                   }
                   catch (Exception e)
  @@ -194,7 +194,7 @@
                               groupManager.addGroup(groupName);
                               this.clearBrowserIterator(request);
                           }
  -                        PortletMessaging.publish(request, 
SecurityResources.USER_BROWSER, "groups", "refresh");
  +                        PortletMessaging.publish(request, 
SecurityResources.TOPIC_USERS, "groups", "refresh");
                       }
                       catch (Exception e)
                       {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to