portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vku...@apache.org
Subject svn commit: r771315 - in /portals/jetspeed-2/applications/j2-admin/trunk: ./ src/main/java/org/apache/jetspeed/portlets/security/ src/main/java/org/apache/jetspeed/portlets/security/resources/ src/webapp/WEB-INF/
Date Mon, 04 May 2009 14:28:10 GMT
Author: vkumar
Date: Mon May  4 14:28:09 2009
New Revision: 771315

URL: http://svn.apache.org/viewvc?rev=771315&view=rev
Log:
Adding edit mode in Wicket browser for setting up default role,subsite and profiling rule
removing jsf bridges from j2-admin

Added:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementEditPortlet.html
  (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementEditPortlet.java
  (with props)
Removed:
    portals/jetspeed-2/applications/j2-admin/trunk/sso-edit-prefs.vm
Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/pom.xml
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementApplication.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet$PrincipalAttributesPanel.html
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/resources/JetspeedPrincipalManagement.properties
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml

Modified: portals/jetspeed-2/applications/j2-admin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/pom.xml?rev=771315&r1=771314&r2=771315&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/pom.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/pom.xml Mon May  4 14:28:09 2009
@@ -71,7 +71,6 @@
         <jetspeed-2.version>2.2-SNAPSHOT</jetspeed-2.version>
         <org.apache.portals.bridges.common.version>1.0.4</org.apache.portals.bridges.common.version>
         <org.apache.portals.bridges.velocity.version>1.0.4</org.apache.portals.bridges.velocity.version>
-        <org.apache.portals.bridges.jsf.version>1.0.4</org.apache.portals.bridges.jsf.version>
         <org.apache.portals.bridges.frameworks.version>1.0.4</org.apache.portals.bridges.frameworks.version>
         <org.apache.portals.bridges.portletfilter.version>1.0.4</org.apache.portals.bridges.portletfilter.version>
         <org.apache.portals.applications.apa-gems.version>1.0-SNAPSHOT</org.apache.portals.applications.apa-gems.version>
@@ -182,17 +181,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.portals.bridges</groupId>
-            <artifactId>portals-bridges-jsf</artifactId>
-            <version>${org.apache.portals.bridges.jsf.version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-          </exclusion>
-        </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.portals.bridges</groupId>
             <artifactId>portals-bridges-portletfilter</artifactId>
             <version>${org.apache.portals.bridges.portletfilter.version}</version>
         <exclusions>

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementApplication.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementApplication.java?rev=771315&r1=771314&r2=771315&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementApplication.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementApplication.java
Mon May  4 14:28:09 2009
@@ -32,7 +32,7 @@
     protected void init()
     {
         super.init();
-        
+        mountBookmarkablePage("/builder",JetspeedPrincipalManagementEditPortlet.class);
         getResourceSettings().addStringResourceLoader(
                 new BundleStringResourceLoader("org.apache.jetspeed.portlets.security.resources.JetspeedPrincipalManagement"));
     }

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementEditPortlet.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementEditPortlet.html?rev=771315&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementEditPortlet.html
(added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementEditPortlet.html
Mon May  4 14:28:09 2009
@@ -0,0 +1,41 @@
+<!-- 
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+  
+  Author <a href="mailto:vkumar@apache.org">Vivek Kumar</a>
+ -->
+<?xml version="1.0" encoding="UTF-8"?>
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+    <form wicket:id="userPrefernces">
+        <table  cellpadding="0" cellspacing="1" border="1" width="300px">
+            <tr>
+                <td><span wicket:id="subsiteLabel"/></td>
+                <td><input type="text" wicket:id="defaultSubSite" class="portlet-form-field-label"
/></td>				
+            </tr>
+            <tr>
+                <td><span wicket:id="profileLabel"/></td>
+                <td><select wicket:id="profile"></select></td>		
	
+            </tr>
+            <tr>
+                <td><span wicket:id="roleLabel"/></td>
+                <td><select wicket:id="role"></select></td>				
+            </tr>
+            <tr>
+                <td colspan="2"><input type="submit" wicket:id="addUserPrefernces"
/></td>			
+            </tr>
+        </table>    
+    </form>
+</html>
\ No newline at end of file

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementEditPortlet.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementEditPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementEditPortlet.java?rev=771315&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementEditPortlet.java
(added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementEditPortlet.java
Mon May  4 14:28:09 2009
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.ReadOnlyException;
+import javax.portlet.ValidatorException;
+
+import org.apache.jetspeed.portlets.AdminPortletWebPage;
+import org.apache.jetspeed.portlets.wicket.AbstractAdminWebApplication;
+import org.apache.jetspeed.profiler.rules.ProfilingRule;
+import org.apache.jetspeed.security.SecurityException;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Button;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.RequiredTextField;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.model.ResourceModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author vkumar <a href="vkumar@apache.org">Vivek Kumar</a>
+ */
+public class JetspeedPrincipalManagementEditPortlet extends AdminPortletWebPage
+{
+
+    private String subite;
+    private String profile;
+    private String role;
+    private Logger log = LoggerFactory.getLogger(JetspeedPrincipalManagementEditPortlet.class);
+
+    public JetspeedPrincipalManagementEditPortlet()
+    {
+        PortletRequest request = ((AbstractAdminWebApplication) getApplication()).getPortletRequest();
+        subite = request.getPreferences().getValue(JetspeedPrincipalManagementPortlet.DEFAULT_SUBSITE,
"");
+        profile = request.getPreferences().getValue(JetspeedPrincipalManagementPortlet.DEFAULT_PROFILE,
"");
+        role = request.getPreferences().getValue(JetspeedPrincipalManagementPortlet.DEFAULT_ROLE,
"");
+        Form userPrefernces = new Form("userPrefernces");
+        userPrefernces.add(new Label("subsiteLabel", new ResourceModel("default.subsite")));
+        userPrefernces.add(new RequiredTextField("defaultSubSite", new PropertyModel(this,
"subite")));
+        userPrefernces.add(new Label("profileLabel", new ResourceModel("default.profile")));
+        userPrefernces.add(new DropDownChoice("profile", new PropertyModel(this, "profile"),
getProfileList()));
+        userPrefernces.add(new Label("roleLabel", new ResourceModel("default.role")));
+        userPrefernces.add(new DropDownChoice("role", new PropertyModel(this, "role"), getRoleNames()));
+        userPrefernces.add(new Button("addUserPrefernces", new ResourceModel("common.save"))
+        {
+            @Override
+            public void onSubmit()
+            {
+                PortletRequest request = ((AbstractAdminWebApplication) getApplication()).getPortletRequest();
+                try
+                {
+                    if (log.isDebugEnabled())
+                    {
+                        log.debug("Setting default role as " + getRole());
+                        log.debug("Setting default subsite as " + getSubite());
+                        log.debug("Setting default profile as " + getSubite());
+                    }
+                    request.getPreferences().setValue(JetspeedPrincipalManagementPortlet.DEFAULT_ROLE,
getRole());
+                    request.getPreferences().setValue(JetspeedPrincipalManagementPortlet.DEFAULT_SUBSITE,
getSubite());
+                    request.getPreferences().setValue(JetspeedPrincipalManagementPortlet.DEFAULT_PROFILE,
getProfile());
+                    request.getPreferences().store();
+                    if (log.isDebugEnabled())
+                    {
+                        log.debug("Default settiing for portlet saved . ");
+                    }
+                }
+                catch (ValidatorException e)
+                {
+                    if (log.isErrorEnabled())
+                    {
+                        log.error(e.getMessage());
+                    }
+                    error(e.getMessage());
+                }
+                catch (IOException e)
+                {
+                    if (log.isErrorEnabled())
+                    {
+                        log.error(e.getMessage());
+                    }
+                    error(e.getMessage());
+                }
+                catch (ReadOnlyException e)
+                {
+                    if (log.isErrorEnabled())
+                    {
+                        log.error(e.getMessage());
+                    }
+                    error(e.getMessage());
+                }
+            }
+        });
+        add(userPrefernces);
+    }
+
+    /**
+     * @return the subite
+     */
+    public String getSubite()
+    {
+        return subite;
+    }
+
+    /**
+     * @param subite
+     *            the subite to set
+     */
+    public void setSubite(String subite)
+    {
+        this.subite = subite;
+    }
+
+    /**
+     * @return the profile
+     */
+    public String getProfile()
+    {
+        return profile;
+    }
+
+    /**
+     * @param profile
+     *            the profile to set
+     */
+    public void setProfile(String profile)
+    {
+        this.profile = profile;
+    }
+
+    /**
+     * @return the role
+     */
+    public String getRole()
+    {
+        return role;
+    }
+
+    /**
+     * @param role
+     *            the role to set
+     */
+    public void setRole(String role)
+    {
+        this.role = role;
+    }
+    
+    private List<String> getProfileList()
+    {
+        ArrayList<String> profileList = new ArrayList<String>();
+        List profileRules = (List)((AbstractAdminWebApplication)getApplication()).getServiceLocator().getProfiler().getRules();
+        for(int counter=0;counter<profileRules.size();counter++)
+        {
+            profileList.add(((ProfilingRule)profileRules.get(counter)).getId());
+        }
+        
+        return profileList;
+    }
+    
+    private List<String> getRoleNames()
+    {
+        List<String> roleNames=Collections.EMPTY_LIST;
+        try{
+            roleNames= ((AbstractAdminWebApplication)getApplication()).getServiceLocator().getRoleManager().getRoleNames("");
 
+        }
+        catch (SecurityException e) {
+            error(e.getMessage());
+        }
+        
+        return  roleNames;
+    }
+}

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementEditPortlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet$PrincipalAttributesPanel.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet%24PrincipalAttributesPanel.html?rev=771315&r1=771314&r2=771315&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet$PrincipalAttributesPanel.html
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet$PrincipalAttributesPanel.html
Mon May  4 14:28:09 2009
@@ -26,7 +26,7 @@
 		<table cellpadding="0" cellspacing="0" border="0">
 			<tr  class="even" wicket:id="attributeEntries">
 				<td>				
-					<input type="text" wicket:id="name"/>
+					<input type="text" wicket:id="name" readonly/>
 				</td>
 				<td>				
 					<input type="text" wicket:id="value"/>

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java?rev=771315&r1=771314&r2=771315&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
Mon May  4 14:28:09 2009
@@ -27,9 +27,12 @@
 import java.util.Map;
 import java.util.ResourceBundle;
 
+import javax.portlet.PortletPreferences;
+
 import org.apache.commons.lang.StringUtils;
 import org.apache.jetspeed.audit.AuditActivity;
 import org.apache.jetspeed.portlets.AdminPortletWebPage;
+import org.apache.jetspeed.portlets.wicket.AbstractAdminWebApplication;
 import org.apache.jetspeed.portlets.wicket.component.CheckBoxPropertyColumn;
 import org.apache.jetspeed.portlets.wicket.component.JavascriptEventConfirmation;
 import org.apache.jetspeed.portlets.wicket.component.PortletOddEvenItem;
@@ -43,6 +46,7 @@
 import org.apache.jetspeed.security.JetspeedPrincipalType;
 import org.apache.jetspeed.security.PasswordAlreadyUsedException;
 import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.RoleManager;
 import org.apache.jetspeed.security.SecurityAttribute;
 import org.apache.jetspeed.security.SecurityException;
 import org.apache.jetspeed.security.User;
@@ -96,6 +100,10 @@
     static final Logger log = LoggerFactory.getLogger(JetspeedPrincipalManagementPortlet.class);
 
     private static final String principalParamName = "principalParam";
+    
+    public static final String DEFAULT_SUBSITE = "defaultSubsite";
+    public static final String DEFAULT_ROLE = "defaultRole";
+    public static final String DEFAULT_PROFILE = "defaultProfile";
 
     private static final java.sql.Date MAX_DATE = java.sql.Date
             .valueOf("8099-01-01");
@@ -135,7 +143,7 @@
     {
         super();
         List tabs;
-
+        
         principalParam = getPreference(principalParamName);
         if (principalParam == null)
         {
@@ -387,8 +395,7 @@
                         }
                     } catch (Exception e)
                     {
-                        SecurityUtil.publishErrorMessage(getPortletRequest(),
-                                SecurityResources.TOPIC_USER, e.getMessage());
+                        error(e.getMessage());
                     }
                     refreshData();
                 }
@@ -467,10 +474,7 @@
                                             AdminPortletWebPage.USER_ADMINISTRATION);
                         } catch (Exception e)
                         {
-                            SecurityUtil.publishErrorMessage(
-                                    getPortletRequest(),
-                                    SecurityResources.TOPIC_USER, e
-                                            .getMessage());
+                            error(e.getMessage());
                         }
                         refreshData();
                     }
@@ -652,6 +656,13 @@
         protected NewUserPrincipalPanel(String id)
         {
             super(id);
+            
+            PortletPreferences preferences = ((AbstractAdminWebApplication)getApplication()).getPortletRequest().getPreferences();
+            
+            final String defaultRole = preferences.getValue(DEFAULT_ROLE ,"");
+            final String defaultProfile = preferences.getValue(DEFAULT_PROFILE ,"");
+            final String defaultSubsite = preferences.getValue(DEFAULT_SUBSITE ,"");
+            
             add(new FeedbackPanel("feedback"));
             Form userForm = new Form("newUserForm");
             add(userForm);
@@ -674,13 +685,20 @@
                 @Override
                 public void onSubmit()
                 {
+                    UserManager userManager = (UserManager)getManager();
                     JetspeedPrincipal principal = getManager().newPrincipal(
                             getUserName(), false);
+                    RoleManager roleManager = ((AbstractAdminWebApplication)getApplication()).getServiceLocator().getRoleManager();
                     try
                     {
                         getManager().addPrincipal(principal, null);
-                        User user = ((UserManager) getManager())
-                                .getUser(getUserName());
+                        User user = userManager.getUser(getUserName());
+
+                        if(!StringUtils.isEmpty(defaultRole))
+                        {
+                            roleManager.addRoleToUser(getUserName(), defaultRole);
+                        }
+                       
                         if (!StringUtils.isEmpty(getProfilingRule()))
                         {
                             getServiceLocator()
@@ -691,8 +709,24 @@
                                                     .getProfiler()
                                                     .getRule(getProfilingRule()),
                                             "default");
+                        }else if(!StringUtils.isEmpty(defaultProfile)){
+                            getServiceLocator()
+                            .getProfiler()
+                            .setRuleForPrincipal(
+                                    principal,
+                                    getServiceLocator()
+                                            .getProfiler()
+                                            .getRule(defaultProfile),
+                                    "default");
+                        }
+                        
+                        if(!StringUtils.isEmpty(defaultSubsite))
+                        {
+                            user.getSecurityAttributes().getAttribute(User.JETSPEED_USER_SUBSITE_ATTRIBUTE,true).setStringValue(defaultSubsite);
                         }
-                        UserManager userManager = (UserManager) getManager();
+                        
+                        userManager.updateUser(user);
+                                                
                         PasswordCredential credential = userManager
                                 .getPasswordCredential(user);
                         if (!StringUtils.isEmpty(getPassword()))
@@ -718,7 +752,7 @@
     protected class NewPrincipalPanel extends Panel
     {
 
-        protected String userName;
+        protected String userName;        
 
         /**
          * @return the userName
@@ -740,6 +774,10 @@
         protected NewPrincipalPanel(String id)
         {
             super(id);
+            
+            
+            
+            
             Form userForm = new Form("newUserForm");
             add(userForm);      
             add(new FeedbackPanel("feedback"));
@@ -752,7 +790,7 @@
 				public void onSubmit() {
 					JetspeedPrincipal principal =  getManager().newPrincipal(getUserName(),false);
 					try{
-						getManager().addPrincipal(principal, null);
+						getManager().addPrincipal(principal, null);						
 					}
 				    catch (SecurityException jSx)
 	                {
@@ -779,25 +817,6 @@
                     error(validatable);
                 }
         }
-        /* (non-Javadoc)
-         * @see org.apache.wicket.validation.validator.AbstractValidator#resourceKey()
-         */
-        @Override
-        protected String resourceKey()
-        {
-            // TODO Auto-generated method stub
-            return super.resourceKey();
-        }
-        /* (non-Javadoc)
-         * @see org.apache.wicket.validation.validator.AbstractValidator#variablesMap(org.apache.wicket.validation.IValidatable)
-         */
-        @Override
-        protected Map variablesMap(IValidatable validatable)
-        {
-            // TODO Auto-generated method stub
-            return super.variablesMap(validatable);
-        }
-        
     }
 
     protected class PrincipalProfilePanel extends Panel
@@ -1044,32 +1063,16 @@
                         manager.storePasswordCredential(credential);
                     } catch (InvalidPasswordException ipe)
                     {
-                        SecurityUtil
-                                .publishErrorMessage(
-                                        getPortletRequest(),
-                                        SecurityResources.TOPIC_USER,
-                                        bundle
-                                                .getString("chgpwd.error.invalidPassword"));
+                        error(ipe.getMessage());
                     } catch (InvalidNewPasswordException inpe)
                     {
-                        SecurityUtil
-                                .publishErrorMessage(
-                                        getPortletRequest(),
-                                        SecurityResources.TOPIC_USER,
-                                        bundle
-                                                .getString("chgpwd.error.invalidNewPassword"));
+                        error(inpe.getMessage());
                     } catch (PasswordAlreadyUsedException paue)
                     {
-                        SecurityUtil
-                                .publishErrorMessage(
-                                        getPortletRequest(),
-                                        SecurityResources.TOPIC_USER,
-                                        bundle
-                                                .getString("chgpwd.error.passwordAlreadyUsed"));
+                        error(paue.getMessage());
                     } catch (SecurityException e)
                     {
-                        SecurityUtil.publishErrorMessage(getPortletRequest(),
-                                SecurityResources.TOPIC_USER, e.getMessage());
+                        error(e.getMessage());
                     }
                     refreshData();
                     setPrincipal(getPrincipal());
@@ -1252,8 +1255,7 @@
                             return !attrib.isReadOnly();
                         }
                     });
-                    item.add(new TextField("value", new Model(attrib
-                            .getStringValue()))
+                    item.add(new TextField("value", new PropertyModel<String>(attrib,"stringValue"))
                     {
 
                         @Override
@@ -1299,25 +1301,23 @@
 
                 public void onSubmit()
                 {
-                    // Preferences prefs = user.getUserAttributes();
-                    Map<String, String> attribs = getPrincipal().getInfoMap();
+                    Map<String, SecurityAttribute> attribs = getPrincipal().getSecurityAttributes().getAttributeMap()
;
                     for (Iterator it = userAttributes.iterator(); it.hasNext();)
                     {
                         Map userAttrMap = (Map) it.next();
                         String userAttrName = (String) userAttrMap.get("name");
                         String userAttrValue = ((SecurityAttribute) userAttrMap
                                 .get("value")).getStringValue();
-                        String oldUserAttrValue = attribs.get(userAttrName);
+                        String oldUserAttrValue = attribs.get(userAttrName).getStringValue();
                         Map<String,SecurityAttribute> userAttributes = getPrincipal().getSecurityAttributes().getAttributeMap();
                         try
                         {
-                            getPrincipal().getSecurityAttributes().getAttribute(userAttrName).setStringValue(userAttrName);
+                            getPrincipal().getSecurityAttributes().getAttribute(userAttrName).setStringValue(userAttrValue);
                         }
                         catch (SecurityException e)
                         {
                             log.error("Failed to update security attribute of principal.",
e);
-                        }
-                        attribs.put(userAttrName, userAttrValue);
+                        }                        
                         getServiceLocator()
                                 .getAuditActivity()
                                 .logAdminAttributeActivity(
@@ -1329,6 +1329,14 @@
                                         userAttrValue,
                                         AdminPortletWebPage.USER_ADMINISTRATION);
                     }
+                    try
+                    {
+                        getManager().updatePrincipal(getPrincipal());
+                    }
+                    catch (SecurityException e)
+                    {
+                        error(e.getMessage());
+                    }
                     refreshData();
                 }
             };       

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/resources/JetspeedPrincipalManagement.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/resources/JetspeedPrincipalManagement.properties?rev=771315&r1=771314&r2=771315&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/resources/JetspeedPrincipalManagement.properties
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/resources/JetspeedPrincipalManagement.properties
Mon May  4 14:28:09 2009
@@ -6,6 +6,7 @@
 common.update=Update
 common.edit=Edit
 common.name=Name
+common.save=Save
 common.value=Value
 common.enabled=Enabled
 common.search=Search
@@ -52,4 +53,13 @@
 group.new.button=New Group
 group.name=Group Name
 group.remove.button=Remove Group
-group.update.button=Update Group
\ No newline at end of file
+group.update.button=Update Group
+
+default.role=Default role
+default.profile=Default profile
+default.subsite=Default sub-site
+
+JetspeedPrincipalManagementPortlet$PrincipalNameValidator=User already exists, cannot add
new user
+chgpwd.error.invalidPassword=Current password invalid
+chgpwd.error.invalidNewPassword=Invalid new password
+chgpwd.error.passwordAlreadyUsed=Password already used
\ No newline at end of file

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml?rev=771315&r1=771314&r2=771315&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml Mon May
 4 14:28:09 2009
@@ -1325,12 +1325,17 @@
       <value>/jetspeedPrincipalmanagement</value>
     </init-param>
     <init-param>
+      <name>editPage</name>
+      <value>/jetspeedPrincipalmanagement/builder</value>
+    </init-param>        
+    <init-param>
       <name>principalParam</name>
       <value>user</value>
     </init-param>	
     <supports>
       <mime-type>*/*</mime-type>
       <portlet-mode>VIEW</portlet-mode>
+      <portlet-mode>EDIT</portlet-mode>
     </supports>
     <supported-locale>en</supported-locale>
     <portlet-info>



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


Mime
View raw message