portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vku...@apache.org
Subject svn commit: r724850 [2/2] - in /portals/jetspeed-2/applications/j2-admin/trunk/src: main/java/org/apache/jetspeed/portlets/security/ webapp/WEB-INF/
Date Tue, 09 Dec 2008 19:46:45 GMT
Added: 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=724850&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java Tue Dec  9 11:46:44 2008
@@ -0,0 +1,1492 @@
+/*
+ * 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.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.apache.commons.logging.Log;
+import org.apache.jetspeed.audit.AuditActivity;
+import org.apache.jetspeed.portlets.security.users.WicketUserAdmin;
+import org.apache.jetspeed.portlets.wicket.component.CheckBoxPropertyColumn;
+import org.apache.jetspeed.portlets.wicket.component.PortletOddEvenItem;
+import org.apache.jetspeed.profiler.rules.PrincipalRule;
+import org.apache.jetspeed.profiler.rules.ProfilingRule;
+import org.apache.jetspeed.security.InvalidNewPasswordException;
+import org.apache.jetspeed.security.InvalidPasswordException;
+import org.apache.jetspeed.security.JetspeedPrincipal;
+import org.apache.jetspeed.security.JetspeedPrincipalAssociationType;
+import org.apache.jetspeed.security.JetspeedPrincipalManager;
+import org.apache.jetspeed.security.JetspeedPrincipalType;
+import org.apache.jetspeed.security.PasswordAlreadyUsedException;
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.SecurityAttribute;
+import org.apache.jetspeed.security.SecurityException;
+import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.UserCredential;
+import org.apache.jetspeed.security.UserManager;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.HeadersToolbar;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.NavigationToolbar;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
+import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
+import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
+import org.apache.wicket.extensions.markup.html.tabs.ITab;
+import org.apache.wicket.extensions.markup.html.tabs.TabbedPanel;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Button;
+import org.apache.wicket.markup.html.form.Check;
+import org.apache.wicket.markup.html.form.CheckBox;
+import org.apache.wicket.markup.html.form.CheckGroup;
+import org.apache.wicket.markup.html.form.CheckGroupSelector;
+import org.apache.wicket.markup.html.form.ChoiceRenderer;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.PasswordTextField;
+import org.apache.wicket.markup.html.form.RadioChoice;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.list.PageableListView;
+import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+
+/**
+ * @author vkumar <a href="vkumar@apache.org">Vivek Kumar</a>
+ */
+public class JetspeedPrincipalManagementPortlet extends WicketUserAdmin
+{
+    private Log log;
+    private static final String principalParamName = "principalParam";
+    private String principalParam;
+    private JetspeedPrincipalManager manager;
+    private JetspeedPrincipalType principalType;
+    protected List userNameList;
+    protected String searchString;
+    protected boolean filtered;
+    protected JetspeedPrincipal principal;
+    protected String selectedUserName;
+    protected List tabs;
+    protected List principalList;
+    // String tabNames[][] = new String[5][2];
+    private static final java.sql.Date MAX_DATE = java.sql.Date.valueOf("8099-01-01");
+    protected boolean detailMode;
+
+    /**
+     * @return the detailMode
+     */
+    public boolean isDetailMode()
+    {
+        return detailMode;
+    }
+
+    /**
+     * @param detailMode
+     *            the detailMode to set
+     */
+    public void setDetailMode(boolean detailMode)
+    {
+        this.detailMode = detailMode;
+    }
+
+    /**
+     * @return the principalList
+     */
+    public List getPrincipalList()
+    {
+        return principalList;
+    }
+
+    /**
+     * @param principalList
+     *            the principalList to set
+     */
+    public void setPrincipalList(List principalList)
+    {
+        this.principalList = principalList;
+    }
+
+    public JetspeedPrincipalManagementPortlet()
+    {
+        super();
+        principalParam = getInitParam(principalParamName);
+        principalType = getJetspeedPrincipalManagerProvider().getPrincipalType(principalParam);
+        ITab tab = null;
+        tabs = new ArrayList();
+        this.userNameList = new ArrayList();
+        try
+        {
+            userNameList = getUserManager().getUsers(getSearchString());
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        final CheckGroup group = new CheckGroup("group", new ArrayList());
+        Form form = new Form("form")
+        {
+            protected void onSubmit()
+            {
+                info("selected person(s): " + group.getModelObjectAsString());
+            }
+        };
+        PageableListView usersList = new PageableListView("entries", new PropertyModel(this, "principalList"), 10)
+        {
+            protected void populateItem(ListItem item)
+            {
+                final JetspeedPrincipal user = (JetspeedPrincipal) item.getModelObject();
+                item.add(new Check("checkbox", item.getModel()));
+                item.add(new Link("link", item.getModel())
+                {
+                    @Override
+                    public void onClick()
+                    {
+                        JetspeedPrincipal user = (JetspeedPrincipal) getModelObject();
+                        setPrincipal(user);
+                        controlPannels(true);
+                    }
+                });
+                item.add(new Label("name", user.getName()));
+            }
+        };
+        form.add(group);
+        group.add(new CheckGroupSelector("groupselector"));
+        group.add(usersList);
+        group.add(new PagingNavigator("navigator", usersList));
+        add(form);
+        Form searchForm = new Form("searchForm")
+        {
+            protected void onSubmit()
+            {
+                setPrincipal(null);
+            }
+        };
+        TextField searchStringField = new TextField("searchString", new PropertyModel(this, "searchString"));
+        searchForm.add(searchStringField);
+        Button searchbutton = new Button("searchButton");
+        searchForm.add(searchbutton);
+        Button newPrincipal = new Button("newPrincipal")
+        {
+            public void onSubmit()
+            {
+                setPrincipal(null);
+                controlPannels(false);
+            }
+        };
+        newPrincipal.setLabel(new Model("lets C"));
+        searchForm.add(newPrincipal);
+        add(searchForm);
+        Label label = new Label("userLabel", "Principal name");
+        label.setVisible(false);
+        add(label);
+        TextField fld = new TextField("userName", new PropertyModel(this, "principal.name"));
+        fld.setVisible(false);
+        add(fld);
+        add(new TabbedPanel("tabs", tabs));
+        controlPannels(false);
+    }
+
+    public void setSearchString(String searchString)
+    {
+        this.searchString = (searchString == null ? "" : searchString.trim());
+        setPrincipal(null);
+        controlPannels(false);
+    }
+
+    public String getSearchString()
+    {
+        return (this.searchString == null ? "" : this.searchString);
+    }
+
+    public void setFiltered(boolean filtered)
+    {
+        this.filtered = filtered;
+    }
+
+    public boolean getFiltered()
+    {
+        return getSearchString() == null ? false : true;
+    }
+
+    public String getSelectedUserName()
+    {
+        return this.principal.getName();
+    }
+
+    public void setPrincipal(JetspeedPrincipal principal)
+    {
+        this.principal = principal;
+    }
+
+    public void setUserNameList(List userNameList)
+    {
+        this.userNameList = userNameList;
+    }
+
+    protected class UserPrincipalProfilePanel extends Panel
+    {
+        protected String locatorName;
+        protected String ruleName;
+        protected List fullRules;
+        protected List userRules;
+        boolean userEnabled;
+
+        /**
+         * @param userEnabled
+         *            the userEnabled to set
+         */
+        public void setUserEnabled(boolean userEnabled)
+        {
+            this.userEnabled = userEnabled;
+        }
+
+        /**
+         * @return the userEnabled
+         */
+        public boolean isUserEnabled()
+        {
+            return userEnabled;
+        }
+
+        protected UserPrincipalProfilePanel(String id)
+        {
+            super(id);
+            if (fullRules == null || userRules == null)
+            {
+                refreshData();
+            }
+            Form profileForm = new Form("profileForm")
+            {
+                @Override
+                protected void onSubmit()
+                {
+                    try
+                    {
+                        getPrincipal().setEnabled(isUserEnabled());
+                        getManager().updatePrincipal(principal);
+                        setPrincipal(principal);
+                    }
+                    catch (SecurityException jSx)
+                    {
+                        jSx.printStackTrace();
+                    }
+                }
+            };
+            add(profileForm);
+            profileForm.add(new CheckBox("userEnabled", new PropertyModel(this, "userEnabled")));
+            profileForm.add(new Button("submit"));
+            Form userRulesForm = new Form("userRulesForm")
+            {
+                protected void onSubmit()
+                {
+                    try
+                    {
+                        Collection rules = getProfiler().getRulesForPrincipal(getPrincipal());
+                        for (Iterator it = getUserRules().iterator(); it.hasNext();)
+                        {
+                            Map ruleMap = (Map) it.next();
+                            if (Boolean.TRUE.equals(ruleMap.get("checked")))
+                            {
+                                String locatorName = ((PrincipalRule) ruleMap.get("rule")).getLocatorName();
+                                for (Iterator ruleIter = rules.iterator(); ruleIter.hasNext();)
+                                {
+                                    PrincipalRule rule = (PrincipalRule) ruleIter.next();
+                                    if (rule.getLocatorName().equals(locatorName))
+                                    {
+                                        getProfiler().deletePrincipalRule(rule);
+                                        getAuditActivity().logAdminAuthorizationActivity(getPortletRequest().getUserPrincipal().getName(), getIPAddress(),
+                                                                                         getSelectedPrincipal(), AuditActivity.USER_DELETE_PROFILE,
+                                                                                         rule.getProfilingRule().getId() + "-" + rule.getLocatorName(),
+                                                                                         USER_ADMINISTRATION);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    catch (Exception e)
+                    {
+                        SecurityUtil.publishErrorMessage(getPortletRequest(), SecurityResources.TOPIC_USER, e.getMessage());
+                    }
+                    refreshData();
+                }
+            };
+            SortableDataProvider dataProvider = new SortableDataProvider()
+            {
+                public int size()
+                {
+                    return getUserRules().size();
+                }
+
+                public IModel model(Object object)
+                {
+                    Map ruleMap = (Map) object;
+                    return new Model((Serializable) ruleMap);
+                }
+
+                public Iterator iterator(int first, int count)
+                {
+                    return getUserRules().subList(first, first + count).iterator();
+                }
+            };
+            IColumn[] columns = { new CheckBoxPropertyColumn(new Model(" "), "checked"), new PropertyColumn(new Model("security.name"), "rule.locatorName"),
+                                 new PropertyColumn(new Model("security.value"), "rule.profilingRule") };
+            DataTable userRulesDataTable = new DataTable("entries", columns, dataProvider, 10)
+            {
+                protected Item newRowItem(String id, int index, IModel model)
+                {
+                    return new PortletOddEvenItem(id, index, model);
+                }
+            };
+            userRulesDataTable.addTopToolbar(new HeadersToolbar(userRulesDataTable, dataProvider));
+            userRulesDataTable.addBottomToolbar(new NavigationToolbar(userRulesDataTable));
+            userRulesForm.add(userRulesDataTable);
+            add(userRulesForm);
+            Form addRuleForm = new Form("addRuleForm")
+            {
+                protected void onSubmit()
+                {
+                    String locatorName = getLocatorName();
+                    if (locatorName != null && locatorName.trim().length() > 0)
+                    {
+                        try
+                        {
+                            String ruleName = getRuleName();
+                            getProfiler().setRuleForPrincipal(getPrincipal(), getProfiler().getRule(ruleName), locatorName);
+                            getAuditActivity().logAdminAuthorizationActivity(getPortletRequest().getUserPrincipal().getName(), getIPAddress(),
+                                                                             getSelectedPrincipal(), AuditActivity.USER_ADD_PROFILE,
+                                                                             ruleName + "-" + locatorName, USER_ADMINISTRATION);
+                        }
+                        catch (Exception e)
+                        {
+                            SecurityUtil.publishErrorMessage(getPortletRequest(), SecurityResources.TOPIC_USER, e.getMessage());
+                        }
+                        refreshData();
+                    }
+                }
+            };
+            TextField locatorNameField = new TextField("locatorName", new PropertyModel(this, "locatorName"));
+            addRuleForm.add(locatorNameField);
+            DropDownChoice ruleNameField = new DropDownChoice("ruleName", new PropertyModel(this, "ruleName"), getFullRules());
+            addRuleForm.add(ruleNameField);
+            add(addRuleForm);
+        }
+
+        protected void refreshData()
+        {
+            try
+            {
+                if (getPrincipal() != null)
+                {
+                    userEnabled = getUserManager().getUser(getSelectedPrincipal()).isEnabled();
+                }
+                this.fullRules = new ArrayList();
+                this.userRules = new ArrayList();
+                for (Iterator it = getProfiler().getRules().iterator(); it.hasNext();)
+                {
+                    ProfilingRule rule = (ProfilingRule) it.next();
+                    this.fullRules.add(rule);
+                }
+                if (getPrincipal() != null)
+                {
+                    for (Iterator it = getProfiler().getRulesForPrincipal(getPrincipal()).iterator(); it.hasNext();)
+                    {
+                        PrincipalRule rule = (PrincipalRule) it.next();
+                        Map ruleMap = new HashMap();
+                        ruleMap.put("rule", rule);
+                        ruleMap.put("checked", Boolean.FALSE);
+                        this.userRules.add(ruleMap);
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+
+        public void setLocatorName(String locatorName)
+        {
+            this.locatorName = locatorName;
+        }
+
+        public String getLocatorName()
+        {
+            return this.locatorName;
+        }
+
+        public void setRuleName(String ruleName)
+        {
+            this.ruleName = ruleName;
+        }
+
+        public String getRuleName()
+        {
+            return this.ruleName;
+        }
+
+        public List getFullRules()
+        {
+            return this.fullRules;
+        }
+
+        public List getUserRules()
+        {
+            return this.userRules;
+        }
+    }
+
+    protected class NewUserPrincipalPanel extends Panel
+    {
+        boolean enabled;
+        protected String locatorName;
+        protected String ruleName;
+        protected List fullRules;
+        protected List userRules;
+
+        /**
+         * @return the enabled
+         */
+        public boolean isEnabled()
+        {
+            return enabled;
+        }
+
+        protected NewUserPrincipalPanel(String id)
+        {
+            super(id);
+            Form userForm = new Form("newUserForm");
+            add(userForm);
+            TextField userName = new TextField("userName");
+            userForm.add(userName);
+            TextField password = new TextField("password");
+            userForm.add(password);
+            CheckBox changePassword = new CheckBox("checkpass");
+            userForm.add(changePassword);
+            DropDownChoice userRole = new DropDownChoice("userRole", getRoleNames(""));
+            userForm.add(userRole);
+            DropDownChoice profilingtRole = new DropDownChoice("profilingRole", getProfileList());
+            userForm.add(profilingtRole);
+            DropDownChoice subsites = new DropDownChoice("subsites", getProfileList());
+            userForm.add(subsites);
+            Button newUser = new Button("addUser");
+            userForm.add(newUser);
+        }
+    }
+
+    protected class NewPrincipalPanel extends Panel
+    {
+        boolean enabled;
+        protected String locatorName;
+        protected String ruleName;
+        protected List fullRules;
+        protected List userRules;
+
+        /**
+         * @return the enabled
+         */
+        public boolean isEnabled()
+        {
+            return enabled;
+        }
+
+        protected NewPrincipalPanel(String id)
+        {
+            super(id);
+            Form userForm = new Form("newUserForm");
+            add(userForm);
+            TextField userName = new TextField("userName");
+            userForm.add(userName);
+            Button newUser = new Button("addUser");
+            userForm.add(newUser);
+        }
+    }
+
+    protected class PrincipalProfilePanel extends Panel
+    {
+        boolean userEnabled = false;
+        String name;
+        protected String locatorName;
+        protected String ruleName;
+        protected List fullRules;
+        protected List userRules;
+
+        /**
+         * @param userEnabled
+         *            the userEnabled to set
+         */
+        public void setUserEnabled(boolean userEnabled)
+        {
+            this.userEnabled = userEnabled;
+        }
+
+        /**
+         * @return the userEnabled
+         */
+        public boolean isUserEnabled()
+        {
+            return userEnabled;
+        }
+
+        /**
+         * @return the name
+         */
+        protected String getName()
+        {
+            return name;
+        }
+
+        protected PrincipalProfilePanel(String id)
+        {
+            super(id);
+            Form profileForm = new Form("profileForm")
+            {
+                @Override
+                protected void onSubmit()
+                {
+                    JetspeedPrincipal principal = getManager().getPrincipal(getName());
+                    try
+                    {
+                        principal.setEnabled(isUserEnabled());
+                        getManager().updatePrincipal(principal);
+                        setPrincipal(principal);
+                    }
+                    catch (SecurityException jSx)
+                    {
+                        jSx.printStackTrace();
+                    }
+                }
+            };
+            add(profileForm);
+            profileForm.add(new CheckBox("userStatus", new PropertyModel(this, "userEnabled")));
+            profileForm.add(new Button("submit"));
+        }
+
+        @Override
+        protected void onBeforeRender()
+        {
+            if (getPrincipal() != null)
+            {
+                this.userEnabled = getPrincipal().isEnabled();
+                this.name = getPrincipal().getName();
+            }
+            super.onBeforeRender();
+        }
+    }
+
+    protected class PrincipalCredentialsPanel extends Panel
+    {
+        protected String userName;
+        protected String credentialValue;
+        protected boolean credentialUpdateRequired;
+        protected Date lastAuthenticationDate;
+        protected boolean credentialEnabled;
+        protected Date credentialExpirationDate;
+        protected String userExpiredFlag;
+        protected UserCredential credential;
+
+        public PrincipalCredentialsPanel(String ID)
+        {
+            super(ID);
+            Form form = new Form("userCredentialForm")
+            {
+                protected void onSubmit()
+                {
+                    ResourceBundle bundle = ResourceBundle.getBundle("org.apache.jetspeed.portlets.security.resources.UsersResources",
+                                                                     getPortletRequest().getLocale());
+                    try
+                    {
+                        boolean passwordSet = false;
+                        UserManager manager = (UserManager) getManager();
+                        PasswordCredential credential = manager.getPasswordCredential((User) getPrincipal());
+                        if (getCredentialValue() != null && getCredentialValue().trim().length() > 0)
+                        {
+                            // getUserManager().setPassword(getUserName(), null, getCredentialValue());
+                            credential.setPassword(null, getCredentialValue());
+                            getAuditActivity().logAdminCredentialActivity(getPortletRequest().getUserPrincipal().getName(), getIPAddress(),
+                                                                          getPrincipal().getName(), AuditActivity.PASSWORD_RESET, USER_ADMINISTRATION);
+                            passwordSet = true;
+                        }
+                        if (getCredentialUpdateRequired() != credential.isUpdateRequired())
+                        {
+                            // getUserManager().setPasswordUpdateRequired(getUserName(), getCredentialUpdateRequired());
+                            credential.setUpdateRequired(getCredentialUpdateRequired());
+                            getAuditActivity()
+                                              .logAdminCredentialActivity(getPortletRequest().getUserPrincipal().getName(), getIPAddress(),
+                                                                          getPrincipal().getName(), AuditActivity.PASSWORD_UPDATE_REQUIRED, USER_ADMINISTRATION);
+                        }
+                        if (getCredentialEnabled() != credential.isEnabled())
+                        {
+                            // getUserManager().setPasswordEnabled(getUserName(), getCredentialEnabled());
+                            credential.setEnabled(getCredentialEnabled());
+                            String activity = (getCredentialEnabled() ? AuditActivity.PASSWORD_ENABLED : AuditActivity.PASSWORD_DISABLED);
+                            getAuditActivity().logAdminCredentialActivity(getPortletRequest().getUserPrincipal().getName(), getIPAddress(),
+                                                                          getPrincipal().getName(), activity, USER_ADMINISTRATION);
+                        }
+                        String expiredFlagStr = getUserExpiredFlag();
+                        if (expiredFlagStr != null)
+                        {
+                            if (!passwordSet && expiredFlagStr.equals("expired"))
+                            {
+                                java.sql.Date today = new java.sql.Date(new Date().getTime());
+                                // getUserManager().setPasswordExpiration(getUserName(), today);
+                                credential.setExpirationDate(today);
+                                getAuditActivity().logAdminCredentialActivity(getPortletRequest().getUserPrincipal().getName(), getIPAddress(),
+                                                                              getPrincipal().getName(), AuditActivity.PASSWORD_EXPIRE, USER_ADMINISTRATION);
+                            }
+                            else if (expiredFlagStr.equals("extend"))
+                            {
+                                // getUserManager().setPasswordExpiration(getUserName(), null);
+                                // TODO confirm with Ate/David
+                                credential.setExpirationDate(MAX_DATE);
+                                getAuditActivity().logAdminCredentialActivity(getPortletRequest().getUserPrincipal().getName(), getIPAddress(),
+                                                                              getPrincipal().getName(), AuditActivity.PASSWORD_EXTEND, USER_ADMINISTRATION);
+                            }
+                            else if (expiredFlagStr.equals("unlimited"))
+                            {
+                                // getUserManager().setPasswordExpiration(getUserName(), User.MAX_DATE);
+                                credential.setExpirationDate(MAX_DATE);
+                                getAuditActivity().logAdminCredentialActivity(getPortletRequest().getUserPrincipal().getName(), getIPAddress(),
+                                                                              getPrincipal().getName(), AuditActivity.PASSWORD_UNLIMITED, USER_ADMINISTRATION);
+                            }
+                        }
+                        manager.storePasswordCredential(credential);
+                    }
+                    catch (InvalidPasswordException ipe)
+                    {
+                        SecurityUtil.publishErrorMessage(getPortletRequest(), SecurityResources.TOPIC_USER, bundle.getString("chgpwd.error.invalidPassword"));
+                    }
+                    catch (InvalidNewPasswordException inpe)
+                    {
+                        SecurityUtil
+                                    .publishErrorMessage(getPortletRequest(), SecurityResources.TOPIC_USER, bundle.getString("chgpwd.error.invalidNewPassword"));
+                    }
+                    catch (PasswordAlreadyUsedException paue)
+                    {
+                        SecurityUtil.publishErrorMessage(getPortletRequest(), SecurityResources.TOPIC_USER,
+                                                         bundle.getString("chgpwd.error.passwordAlreadyUsed"));
+                    }
+                    catch (SecurityException e)
+                    {
+                        SecurityUtil.publishErrorMessage(getPortletRequest(), SecurityResources.TOPIC_USER, e.getMessage());
+                    }
+                    refreshData();
+                    setPrincipal(getPrincipal());
+                }
+            };
+            PasswordTextField credentialValueField = new PasswordTextField("credentialValue", new PropertyModel(this, "credentialValue"));
+            form.add(credentialValueField);
+            CheckBox credentialUpdateRequiredField = new CheckBox("credentialUpdateRequired", new PropertyModel(this, "credentialUpdateRequired"));
+            form.add(credentialUpdateRequiredField);
+            Label lastAuthenticationDateLabel = new Label("lastAuthenticationDate", new PropertyModel(this, "lastAuthenticationDate"));
+            form.add(lastAuthenticationDateLabel);
+            CheckBox credentialEnabledField = new CheckBox("credentialEnabled", new PropertyModel(this, "credentialEnabled"));
+            form.add(credentialEnabledField);
+            Label credentialExpirationDateLabel = new Label("credentialExpirationDate", new PropertyModel(this, "credentialExpirationDate"));
+            form.add(credentialExpirationDateLabel);
+            List expiredFlagChoices = new ArrayList();
+            expiredFlagChoices.add("active");
+            expiredFlagChoices.add("expired");
+            expiredFlagChoices.add("extend");
+            expiredFlagChoices.add("unlimited");
+            RadioChoice userExpiredFlagField = new RadioChoice("userExpiredFlag", new PropertyModel(this, "userExpiredFlag"), expiredFlagChoices);
+            form.add(userExpiredFlagField);
+            add(form);
+        }
+
+        public void setCredentialValue(String credentialValue)
+        {
+            this.credentialValue = credentialValue;
+        }
+
+        public String getCredentialValue()
+        {
+            return this.credentialValue;
+        }
+
+        public void setCredentialUpdateRequired(boolean credentialUpdateRequired)
+        {
+            this.credentialUpdateRequired = credentialUpdateRequired;
+        }
+
+        public boolean getCredentialUpdateRequired()
+        {
+            return this.credentialUpdateRequired;
+        }
+
+        public void setLastAuthenticationDate(Date lastAuthenticationDate)
+        {
+            this.lastAuthenticationDate = lastAuthenticationDate;
+        }
+
+        public Date getLastAuthenticationDate()
+        {
+            return this.lastAuthenticationDate;
+        }
+
+        public void setCredentialEnabled(boolean credentialEnabled)
+        {
+            this.credentialEnabled = credentialEnabled;
+        }
+
+        public boolean getCredentialEnabled()
+        {
+            return this.credentialEnabled;
+        }
+
+        public void setCredentialExpirationDate(Date credentialExpirationDate)
+        {
+            this.credentialExpirationDate = credentialExpirationDate;
+        }
+
+        public Date getCredentialExpirationDate()
+        {
+            return this.credentialExpirationDate;
+        }
+
+        public void setUserExpiredFlag(String userExpiredFlag)
+        {
+            this.userExpiredFlag = userExpiredFlag;
+        }
+
+        public String getUserExpiredFlag()
+        {
+            return this.userExpiredFlag;
+        }
+
+        protected void onBeforeRender()
+        {
+            super.onBeforeRender();
+            if (getPrincipal().getName() != this.userName)
+            {
+                refreshData();
+                this.userName = getPrincipal().getName();
+            }
+        }
+
+        protected void refreshData()
+        {
+            try
+            {
+                UserManager manager = (UserManager) getManager();
+                credential = manager.getPasswordCredential((User) getPrincipal());
+                setCredentialUpdateRequired(credential.isUpdateRequired());
+                setCredentialEnabled(credential.isEnabled());
+                setLastAuthenticationDate(credential.getLastAuthenticationDate());
+                setCredentialExpirationDate(credential.getExpirationDate());
+                setUserExpiredFlag(credential.isExpired() ? "expired" : "active");
+            }
+            catch (SecurityException secExp)
+            {
+                secExp.printStackTrace();
+            }
+        }
+    }
+
+    protected class PrincipalAttributesPanel extends Panel
+    {
+        protected String userName;
+        protected String userAttrName;
+        protected String userAttrValue;
+        protected List userAttributes;
+
+        public PrincipalAttributesPanel(String id)
+        {
+            super(id);
+            Form userAttrsForm = new Form("userAttrsForm");
+            add(userAttrsForm);
+            PageableListView usersList = new PageableListView("attributeEntries", new PropertyModel(this, "userAttributes"), 10)
+            {
+                protected void populateItem(ListItem item)
+                {
+                    final Map<String, SecurityAttribute> attributes = (Map<String, SecurityAttribute>) item.getModelObject();
+                    final SecurityAttribute attrib = attributes.get("value");
+                    item.add(new TextField("name", new Model(attrib.getName()))
+                    {
+                        @Override
+                        public boolean isEnabled()
+                        {
+                            // TODO Auto-generated method stub
+                            return !attrib.isReadOnly();
+                        }
+                    });
+                    item.add(new TextField("value", new Model(attrib.getStringValue()))
+                    {
+                        @Override
+                        public boolean isEnabled()
+                        {
+                            // TODO Auto-generated method stub
+                            return !attrib.isReadOnly();
+                        }
+                    });
+                    if (!attrib.isReadOnly())
+                    {
+                        item.add(new Link("link", item.getModel())
+                        {
+                            @Override
+                            public void onClick()
+                            {
+                                try
+                                {
+                                    getPrincipal().getSecurityAttributes().removeAttribute(attrib.getName());
+                                    getManager().updatePrincipal(getPrincipal());
+                                }
+                                catch (SecurityException e)
+                                {
+                                    e.printStackTrace();
+                                }
+                                setPrincipal(getPrincipal());
+                                refreshData();
+                            }
+                        });
+                    }
+                }
+            };
+            userAttrsForm.add(usersList);
+            userAttrsForm.add(new PagingNavigator("navigator", usersList));
+            Button updateAttrButton = new Button("updateAttr")
+            {
+                public void onSubmit()
+                {
+                    // Preferences prefs = user.getUserAttributes();
+                    Map<String, String> attribs = getPrincipal().getInfoMap();
+                    for (Iterator it = userAttributes.iterator(); it.hasNext();)
+                    {
+                        Map userAttrMap = (Map) it.next();
+                        String userAttrName = (String) userAttrMap.get("name");
+                        String userAttrValue = (String) userAttrMap.get("value");
+                        String oldUserAttrValue = attribs.get(userAttrName);
+                        attribs.put(userAttrName, userAttrValue);
+                        getAuditActivity().logAdminAttributeActivity(getPrincipal().getName(), getIPAddress(), getPrincipal().getName(),
+                                                                     AuditActivity.USER_UPDATE_ATTRIBUTE, userAttrName, oldUserAttrValue, userAttrValue,
+                                                                     USER_ADMINISTRATION);
+                    }
+                    refreshData();
+                }
+            };
+            Button removeAttrButton = new Button("removeAttr")
+            {
+                public void onSubmit()
+                {
+                    boolean save = false;
+                    for (Iterator it = userAttributes.iterator(); it.hasNext();)
+                    {
+                        Map userAttrMap = (Map) it.next();
+                        if (Boolean.TRUE.equals(userAttrMap.get("checked")))
+                        {
+                            String userAttrName = (String) userAttrMap.get("name");
+                            String userAttrValue = (String) userAttrMap.get("value");
+                            SecurityAttribute attr = getPrincipal().getSecurityAttributes().getAttribute(userAttrName);
+                            if (attr != null)
+                            {
+                                userAttrValue = attr.getStringValue();
+                                try
+                                {
+                                    getPrincipal().getSecurityAttributes().removeAttribute(userAttrName);
+                                    getAuditActivity().logAdminAttributeActivity(getPrincipal().getName(), getIPAddress(), getPrincipal().getName(),
+                                                                                 AuditActivity.USER_DELETE_ATTRIBUTE, userAttrName, userAttrValue, "",
+                                                                                 USER_ADMINISTRATION);
+                                    save = true;
+                                }
+                                catch (SecurityException e)
+                                {
+                                    // TODO Auto-generated catch block
+                                    e.printStackTrace();
+                                    save = false;
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                    if (save)
+                    {
+                        try
+                        {
+                            getManager().updatePrincipal(getPrincipal());
+                        }
+                        catch (SecurityException e)
+                        {
+                            // TODO Auto-generated catch block
+                            e.printStackTrace();
+                        }
+                    }
+                    refreshData();
+                }
+            };
+            userAttrsForm.add(updateAttrButton);
+            userAttrsForm.add(removeAttrButton);
+            Form addAttrForm = new Form("addAttrForm")
+            {
+                protected void onSubmit()
+                {
+                    String userAttrName = getUserAttrName();
+                    String userAttrValue = getUserAttrValue();
+                    if (userAttrName != null && userAttrName.trim().length() > 0)
+                    {
+                        // Preferences prefs = user.getUserAttributes();
+                        // prefs.put(userAttrName, userAttrValue);
+                        try
+                        {
+                            getPrincipal().getSecurityAttributes().getAttribute(userAttrName, true).setStringValue(userAttrValue);
+                            getManager().updatePrincipal(getPrincipal());
+                            getAuditActivity()
+                                              .logAdminAttributeActivity(getPrincipal().getName(), getIPAddress(), getPrincipal().getName(),
+                                                                         AuditActivity.USER_ADD_ATTRIBUTE, userAttrName, "", userAttrValue, USER_ADMINISTRATION);
+                        }
+                        catch (SecurityException e)
+                        {
+                            // TODO Auto-generated catch block
+                            e.printStackTrace();
+                        }
+                    }
+                    setPrincipal(getPrincipal());
+                    refreshData();
+                }
+            };
+            add(addAttrForm);
+            TextField userAttrNameField = new TextField("userAttrName", new PropertyModel(this, "userAttrName"));
+            addAttrForm.add(userAttrNameField);
+            TextField userAttrValueField = new TextField("userAttrValue", new PropertyModel(this, "userAttrValue"));
+            addAttrForm.add(userAttrValueField);
+        }
+
+        public List getUserAttributes()
+        {
+            return this.userAttributes;
+        }
+
+        public void setUserAttrName(String userAttrName)
+        {
+            this.userAttrName = userAttrName;
+        }
+
+        public String getUserAttrName()
+        {
+            return this.userAttrName;
+        }
+
+        public void setUserAttrValue(String userAttrValue)
+        {
+            this.userAttrValue = userAttrValue;
+        }
+
+        public String getUserAttrValue()
+        {
+            return this.userAttrValue;
+        }
+
+        protected void onBeforeRender()
+        {
+            if (getPrincipal().getName() != this.userName)
+            {
+                refreshData();
+                this.userName = getPrincipal().getName();
+            }
+            super.onBeforeRender();
+        }
+
+        /*
+         * (non-Javadoc)
+         * @see org.apache.wicket.Component#onDetach()
+         */
+        @Override
+        protected void onDetach()
+        {
+            // TODO Auto-generated method stub
+            super.onDetach();
+        }
+
+        protected void refreshData()
+        {
+            this.userAttributes = new LinkedList();
+            if (getPrincipal() != null)
+            {
+                Map<String, SecurityAttribute> userAttribute = getPrincipal().getSecurityAttributes().getAttributeMap();
+                Map item;
+                String attributeKey;
+                Iterator<String> attribsKeys = userAttribute.keySet().iterator();
+                while (attribsKeys.hasNext())
+                {
+                    attributeKey = attribsKeys.next();
+                    item = new HashMap();
+                    item.put("name", attributeKey);
+                    item.put("value", userAttribute.get(attributeKey));
+                    userAttributes.add(item);
+                }
+            }
+        }
+    }
+
+    protected class AssociationTypePanel extends Panel
+    {
+        private JetspeedPrincipalManager localManager;
+        private JetspeedPrincipalType type;
+        private List names = new ArrayList();
+        private List associations = new ArrayList();
+        private String associationName;
+        private JetspeedPrincipal associationPrincipal;
+        private JetspeedPrincipalAssociationType assoicationType;
+        boolean associationsFrom;
+
+        /**
+         * @return the associations
+         */
+        public List getAssociations()
+        {
+            return associations;
+        }
+
+        /**
+         * @param associations
+         *            the associations to set
+         */
+        public void setAssociations(List associations)
+        {
+            this.associations = associations;
+        }
+
+        /**
+         * @return the selectedPrincipal
+         */
+        public JetspeedPrincipal getAssociationPrincipal()
+        {
+            return associationPrincipal;
+        }
+
+        /**
+         * @param selectedPrincipal
+         *            the selectedPrincipal to set
+         */
+        public void setAssociationPrincipal(JetspeedPrincipal selectedPrincipal)
+        {
+            this.associationPrincipal = selectedPrincipal;
+        }
+
+        /*
+         * public void setAssociationPrincipal(JetspeedPrincipal selectedPrincipal) { this.asstnPrincipal = selectedPrincipal; }
+         */
+        /**
+         * @return the names
+         */
+        public List getNames()
+        {
+            return names;
+        }
+
+        /**
+         * @param names
+         *            the names to set
+         */
+        public void setNames(List names)
+        {
+            this.names = names;
+        }
+
+        public AssociationTypePanel(String id, JetspeedPrincipalAssociationType assoicationType)
+        {
+            super(id);
+            this.assoicationType = assoicationType;
+            associationName = assoicationType.getAssociationName();
+            final String assoctionName = assoicationType.getAssociationName();
+            refreshList();
+            ListView commentListView = new ListView("comments", new PropertyModel(this, "associations"))
+            {
+                public void populateItem(final ListItem listItem)
+                {
+                    final JetspeedPrincipal principal = (JetspeedPrincipal) listItem.getModelObject();
+                    final JetspeedPrincipalManager manager = getManager();
+                    listItem.add(new Label("Name", principal.getName()));
+                    listItem.add(new Link("delete")
+                    {
+                        @Override
+                        public void onClick()
+                        {
+                            try
+                            {
+                                if (!associationsFrom)
+                                {
+                                    manager.removeAssociation(principal, getPrincipal(), assoctionName);
+                                }
+                                else
+                                {
+                                    manager.removeAssociation(getPrincipal(), principal, assoctionName);
+                                }
+                                refreshList();
+                            }
+                            catch (Exception e)
+                            {
+                                // TODO: handle exception
+                            }
+                        }
+                    });
+                }
+            };
+            add(commentListView);
+            Form assocationsForm = new Form("assocationsForm");
+            add(assocationsForm);
+            DropDownChoice dropDown = new DropDownChoice("associationPrincipal", new PropertyModel(this, "associationPrincipal"), getNames(),
+                                                         new ChoiceRenderer("name", "name"));
+            assocationsForm.add(dropDown);
+            Button addRelations = new Button("addRelations")
+            {
+                @Override
+                public void onSubmit()
+                {
+                    try
+                    {
+                        JetspeedPrincipal toPrincipal = getPrincipal();
+                        // JetspeedPrincipal fromPrincipal = getJetspeedPrincipalManagerProvider().getManager(type).getPrincipal(getAssociationPrincipal());
+                        JetspeedPrincipal fromPrincipal = getAssociationPrincipal();
+                        if (!associationsFrom)
+                        {
+                            getManager().addAssociation(fromPrincipal, toPrincipal, associationName);
+                        }
+                        else
+                        {
+                            getManager().addAssociation(toPrincipal, fromPrincipal, associationName);
+                        }
+                        refreshList();
+                    }
+                    catch (SecurityException sExc)
+                    {
+                        sExc.printStackTrace();
+                    }
+                }
+            };
+            assocationsForm.add(addRelations);
+        }
+
+        private JetspeedPrincipalManager getBaseManager(JetspeedPrincipalType type)
+        {
+            return getJetspeedPrincipalManagerProvider().getManager(type);
+        }
+
+        private void refreshList()
+        {
+            names.clear();
+            if (!principal.getType().equals(assoicationType.getFromPrincipalType()))
+            {
+                associations = getBaseManager(assoicationType.getFromPrincipalType()).getAssociatedTo(principal.getName(), principal.getType(),
+                                                                                                      assoicationType.getAssociationName());
+                List tempNames = getBaseManager(assoicationType.getFromPrincipalType()).getPrincipals("");
+                for (int index = 0; index < tempNames.size(); index++)
+                {
+                    names.add(tempNames.get(index));
+                }
+                type = assoicationType.getFromPrincipalType();
+                associationsFrom = false;
+            }
+            else
+            {
+                associations = getBaseManager(assoicationType.getToPrincipalType()).getAssociatedFrom(principal.getName(), principal.getType(),
+                                                                                                      assoicationType.getAssociationName());
+                List tempNames = getBaseManager(assoicationType.getToPrincipalType()).getPrincipals("");
+                for (int index = 0; index < tempNames.size(); index++)
+                {
+                    names.add(tempNames.get(index));
+                }
+                type = assoicationType.getToPrincipalType();
+                associationsFrom = true;
+            }
+            for (int count = 0; count < associations.size(); count++)
+            {
+                JetspeedPrincipal tmpPrincipal = (JetspeedPrincipal) associations.get(count);
+                JetspeedPrincipal listPrincipal;
+                for (int index = 0; index < names.size(); index++)
+                {
+                    listPrincipal = (JetspeedPrincipal) names.get(index);
+                    if (listPrincipal.getName().equals(tmpPrincipal.getName()))
+                    {
+                        names.remove(index);
+                    }
+                }
+            }
+        }
+    }
+
+    protected class PrincipalAssociationsPanel extends Panel
+    {
+        private List tabs;
+
+        /**
+         * @return the selectedAssociationType
+         */
+        public String getSelectedAssociationType()
+        {
+            return selectedAssociationType;
+        }
+
+        /**
+         * @param selectedAssociationType
+         *            the selectedAssociationType to set
+         */
+        public void setSelectedAssociationType(String selectedAssociationType)
+        {
+            this.selectedAssociationType = selectedAssociationType;
+        }
+
+        private List<JetspeedPrincipalAssociationType> assoicationTypes;
+        private String selectedAssociationType;
+
+        /**
+         * @return the assoicationTypes
+         */
+        public List<JetspeedPrincipalAssociationType> getAssoicationTypes()
+        {
+            return assoicationTypes;
+        }
+
+        public PrincipalAssociationsPanel(String id)
+        {
+            super(id);
+            tabs = new ArrayList();
+            this.assoicationTypes = ((JetspeedPrincipalManager) getManager()).getAssociationTypes();
+            ITab tab;
+            for (JetspeedPrincipalAssociationType assoicationType : this.assoicationTypes)
+            {
+                // if (!assoicationType.getToPrincipalType().equals(principalType))
+                // {
+                final JetspeedPrincipalAssociationType tempAssosciation = assoicationType;
+                final JetspeedPrincipalType fromAssoicationType = assoicationType.getFromPrincipalType();
+                final JetspeedPrincipalType toAssoicationType = assoicationType.getToPrincipalType();
+                final String associationName = assoicationType.getAssociationName();
+                if (fromAssoicationType.getName().equals(getPrincipal().getType().getName()))
+                {
+                    tab = new AbstractTab(new Model(toAssoicationType.getName() + " - " + assoicationType.getAssociationName()))
+                    {
+                        public Panel getPanel(String panelId)
+                        {
+                            return new AssociationTypePanel(panelId, tempAssosciation);
+                        }
+                    };
+                }
+                else
+                {
+                    tab = new AbstractTab(new Model(fromAssoicationType.getName() + " - " + assoicationType.getAssociationName()))
+                    {
+                        public Panel getPanel(String panelId)
+                        {
+                            return new AssociationTypePanel(panelId, tempAssosciation);
+                        }
+                    };
+                }
+                tabs.add(tab);
+                // }
+            }
+            add(new TabbedPanel("assocTabs", tabs));
+        }
+
+        /**
+         * @param assoicationTypes
+         *            the assoicationTypes to set
+         */
+        public void setAssoicationTypes(List assoicationTypes)
+        {
+            this.assoicationTypes = assoicationTypes;
+        }
+    }
+
+    private String getSelectedPrincipal()
+    {
+        String principal = "";
+        if (getPrincipal() != null)
+        {
+            principal = getPrincipal().getName();
+        }
+        return principal;
+    }
+
+    private JetspeedPrincipal getPrincipal()
+    {
+        return this.principal;
+    }
+
+    private List getPrincipalLists(String searchString)
+    {
+        return getManager().getPrincipals(searchString);
+    }
+
+    private JetspeedPrincipalManager getManager()
+    {
+        if (manager == null)
+        {
+            manager = getJetspeedPrincipalManagerProvider().getManager(principalType);
+        }
+        return manager;
+    }
+
+    private List getSubsites()
+    {
+        List nameList = null;
+        try
+        {
+            nameList = getRoleManager().getRoleNames("");
+        }
+        catch (SecurityException e)
+        {
+            if (log.isErrorEnabled())
+            {
+                log.error("Error in getting role list");
+            }
+        }
+        return nameList;
+    }
+
+    private List getProfileList()
+    {
+        return (List) getProfiler().getRules();
+    }
+
+    private List getRoleNames(String filter)
+    {
+        List nameList = null;
+        try
+        {
+            nameList = getRoleManager().getRoleNames(filter);
+        }
+        catch (SecurityException e)
+        {
+            if (log.isErrorEnabled())
+            {
+                log.error("Error in getting role list");
+            }
+        }
+        return nameList;
+    }
+
+    private void controlPannels(boolean userSelecteed)
+    {
+        TabbedPanel panel = (TabbedPanel) get("tabs");
+        ITab tab;
+        panel.getTabs().clear();
+        if (userSelecteed)
+        {
+            if (principalType.getName().equals(JetspeedPrincipalType.USER))
+            {
+                tab = new AbstractTab(new Model("User Profile"))
+                {
+                    public Panel getPanel(String panelId)
+                    {
+                        return new UserPrincipalProfilePanel(panelId);
+                    }
+                };
+            }
+            else
+            {
+                tab = new AbstractTab(new Model("User Profile"))
+                {
+                    public Panel getPanel(String panelId)
+                    {
+                        return new PrincipalProfilePanel(panelId);
+                    }
+                };
+            }
+            panel.getTabs().add(tab);
+            tab = new AbstractTab(new Model("Associations"))
+            {
+                public Panel getPanel(String panelId)
+                {
+                    return new PrincipalAssociationsPanel(panelId);
+                }
+            };
+            panel.getTabs().add(tab);
+            tab = new AbstractTab(new Model("Attributes"))
+            {
+                public Panel getPanel(String panelId)
+                {
+                    return new PrincipalAttributesPanel(panelId);
+                }
+            };
+            panel.getTabs().add(tab);
+            if (principalType.getName().equals(JetspeedPrincipalType.USER))
+            {
+                tab = new AbstractTab(new Model("Credentials"))
+                {
+                    public Panel getPanel(String panelId)
+                    {
+                        return new PrincipalCredentialsPanel(panelId);
+                    }
+                };
+                panel.getTabs().add(tab);
+            }
+            panel.setSelectedTab(0);
+        }
+        else
+        {
+            if (principalType.getName().equals(JetspeedPrincipalType.USER))
+            {
+                tab = new AbstractTab(new Model("New " + principalType.getName().toUpperCase()))
+                {
+                    public Panel getPanel(String panelId)
+                    {
+                        return new NewUserPrincipalPanel(panelId);
+                    }
+                };
+            }
+            else
+            {
+                tab = new AbstractTab(new Model("New " + principalType.getName().toUpperCase()))
+                {
+                    public Panel getPanel(String panelId)
+                    {
+                        return new NewPrincipalPanel(panelId);
+                    }
+                };
+            }
+            panel.getTabs().add(tab);
+            panel.setSelectedTab(0);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.wicket.Page#onBeforeRender()
+     */
+    @Override
+    protected void onBeforeRender()
+    {
+        setPrincipalList(getPrincipalLists(getSearchString()));
+        if (getPrincipal() != null)
+        {
+            Label label = (Label) get("userLabel");
+            label.setVisible(true);
+            TextField fl = (TextField) get("userName");
+            fl.setVisible(true);
+        }
+        else
+        {
+            Label label = (Label) get("userLabel");
+            label.setVisible(false);
+            TextField fl = (TextField) get("userName");
+            fl.setVisible(false);
+        }
+        super.onBeforeRender();
+    }
+}

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
------------------------------------------------------------------------------
    svn:keywords = Id

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

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml?rev=724850&r1=724849&r2=724850&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml Tue Dec  9 11:46:44 2008
@@ -145,6 +145,7 @@
         <js:service name='ImporterManager'/>
         <js:service name='AuditActivity'/>
         <js:service name='JetspeedSerializer'/>
+		<js:service name='JetspeedPrincipalManagerProvider'/>        
 	</js:services>
 
 </portlet-app>

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=724850&r1=724849&r2=724850&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 Tue Dec  9 11:46:44 2008
@@ -2089,7 +2089,93 @@
             </preference>
         </portlet-preferences>
    </portlet>
-
+   <portlet>
+    <description>The Wicket User Browser displays a list of users managed in this portal. From here you can select users for editing.</description>
+    <portlet-name>JetspeedPrincipalmanagementUserPortlet</portlet-name>
+    <display-name>Jetspeed Principal User Browser</display-name>
+    <portlet-class>org.apache.jetspeed.portlets.wicket.AdminWicketPortlet</portlet-class>
+    <init-param>
+      <name>wicketFilterPath</name>
+      <value>/jetspeedPrincipalmanagement</value>
+    </init-param>
+    <init-param>
+      <name>principalParam</name>
+      <value>user</value>
+    </init-param>	
+    <init-param>
+      <name>serviceComponentNames</name>
+      <value>cps:UserManager,cps:JetspeedPrincipalManagerProvider,cps:RoleManager,cps:GroupManager,cps:Profiler,cps:AuditActivity</value>
+    </init-param>
+    <supports>
+      <mime-type>*/*</mime-type>
+      <portlet-mode>VIEW</portlet-mode>
+    </supports>
+    <supported-locale>en</supported-locale>
+    <!--<resource-bundle>org.apache.jetspeed.portlets.security.JetspeedPrincipalManagementUsers</resource-bundle> -->
+    <portlet-info>
+        <title>Wicket User Browser</title>
+        <short-title>Users</short-title>
+        <keywords>admin,security,users</keywords>            
+    </portlet-info>
+  </portlet>
+  <portlet>
+    <description>The Wicket Group Browser displays a list of groups managed in this portal. From here you can select groups for editing.</description>
+    <portlet-name>JetspeedPrincipalmanagementGroupPortlet</portlet-name>
+    <display-name>Jetspeed Principal Group Browser</display-name>
+    <portlet-class>org.apache.jetspeed.portlets.wicket.AdminWicketPortlet</portlet-class>
+    <init-param>
+      <name>wicketFilterPath</name>
+      <value>/jetspeedPrincipalmanagement</value>
+    </init-param>
+    <init-param>
+      <name>principalParam</name>
+      <value>group</value>
+    </init-param>	
+    <init-param>
+      <name>serviceComponentNames</name>
+      <value>cps:UserManager,cps:JetspeedPrincipalManagerProvider,cps:RoleManager,cps:GroupManager,cps:Profiler,cps:AuditActivity</value>
+    </init-param>
+    <supports>
+      <mime-type>*/*</mime-type>
+      <portlet-mode>VIEW</portlet-mode>
+    </supports>
+    <supported-locale>en</supported-locale>
+    <!--<resource-bundle>org.apache.jetspeed.portlets.security.JetspeedPrincipalManagementUsers</resource-bundle> -->
+    <portlet-info>
+        <title>Wicket Group Browser</title>
+        <short-title>Groups</short-title>
+        <keywords>admin,security,groups, group</keywords>            
+    </portlet-info>
+  </portlet>
+  <portlet>
+    <description>The Wicket Roles Browser displays a list of roles managed in this portal. From here you can select roles for editing.</description>
+    <portlet-name>JetspeedPrincipalmanagementRolesPortlet</portlet-name>
+    <display-name>Jetspeed Principal Roles Browser</display-name>
+    <portlet-class>org.apache.jetspeed.portlets.wicket.AdminWicketPortlet</portlet-class>
+    <init-param>
+      <name>wicketFilterPath</name>
+      <value>/jetspeedPrincipalmanagement</value>
+    </init-param>
+    <init-param>
+      <name>principalParam</name>
+      <value>role</value>
+    </init-param>	
+    <init-param>
+      <name>serviceComponentNames</name>
+      <value>cps:UserManager,cps:JetspeedPrincipalManagerProvider,cps:RoleManager,cps:GroupManager,cps:Profiler,cps:AuditActivity</value>
+    </init-param>
+    <supports>
+      <mime-type>*/*</mime-type>
+      <portlet-mode>VIEW</portlet-mode>
+    </supports>
+    <supported-locale>en</supported-locale>
+    <!--<resource-bundle>org.apache.jetspeed.portlets.security.JetspeedPrincipalManagementUsers</resource-bundle> -->
+    <portlet-info>
+        <title>Wicket Role Browser</title>
+        <short-title>Roles</short-title>
+        <keywords>admin,security,roles,role</keywords>            
+    </portlet-info>
+   </portlet>
    <custom-portlet-mode>
         <description>a Custom Edit_defaults Mode</description>            
         <portlet-mode>edit_defaults</portlet-mode>

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml?rev=724850&r1=724849&r2=724850&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml Tue Dec  9 11:46:44 2008
@@ -89,6 +89,15 @@
 	</context-param>
     
     <filter>
+      <filter-name>JetspeedPrincipalManagementPortlet</filter-name>
+      <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+      <init-param>
+        <param-name>applicationClassName</param-name>
+        <param-value>org.apache.jetspeed.portlets.security.JetspeedPrincipalManagementApplication</param-value>
+      </init-param>
+    </filter>
+	
+    <filter>
       <filter-name>WicketUserBrowserApplication</filter-name>
       <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
       <init-param>
@@ -107,6 +116,13 @@
     </filter>
     
     <filter-mapping>
+      <filter-name>JetspeedPrincipalManagementPortlet</filter-name>
+      <url-pattern>/jetspeedPrincipalmanagement/*</url-pattern>
+      <dispatcher>REQUEST</dispatcher>
+      <dispatcher>INCLUDE</dispatcher>
+    </filter-mapping>
+	
+    <filter-mapping>
       <filter-name>WicketUserBrowserApplication</filter-name>
       <url-pattern>/userbrowser/*</url-pattern>
       <dispatcher>REQUEST</dispatcher>



---------------------------------------------------------------------
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