You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2004/09/17 02:18:59 UTC

cvs commit: jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/resources SecurityResources.properties

taylor      2004/09/16 17:18:59

  Modified:    applications/pam/src/java/org/apache/jetspeed/portlets/site
                        SiteBrowserPortlet.java SiteDetailPortlet.java
               applications/pam/src/java/org/apache/jetspeed/portlets/security/users
                        UserData.java TabbedPaneBean.java UserBean.java
                        UserManagerPortlet.java
               applications/pam/src/java/org/apache/jetspeed/portlets/pam
                        PortletApplicationBrowser.java
                        PortletApplicationDetail.java
                        PortletApplicationResources.java
  Added:       applications/pam/src/java/org/apache/jetspeed/portlets/security
                        UserBrowserPortlet.java UserDetailsPortlet.java
               applications/pam/src/java/org/apache/jetspeed/portlets/security/resources
                        SecurityResources.properties
  Log:
  cleanup on PAM portlets
  user
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.3       +21 -9     jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/SiteBrowserPortlet.java
  
  Index: SiteBrowserPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/SiteBrowserPortlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SiteBrowserPortlet.java	16 Sep 2004 23:01:02 -0000	1.2
  +++ SiteBrowserPortlet.java	17 Sep 2004 00:18:58 -0000	1.3
  @@ -33,7 +33,6 @@
   import org.apache.jetspeed.om.folder.InvalidFolderException;
   import org.apache.jetspeed.om.page.Page;
   import org.apache.jetspeed.page.PageManager;
  -import org.apache.jetspeed.page.PageNotFoundException;
   import org.apache.jetspeed.page.document.DocumentException;
   import org.apache.jetspeed.page.document.NodeException;
   import org.apache.jetspeed.page.document.NodeSet;
  @@ -53,8 +52,6 @@
       private PortletContext context;
       private PageManager pageManager;
       
  -    private static final String PORTLET_URL = "portlet_url";
  -
       public void init(PortletConfig config)
       throws PortletException 
       {
  @@ -190,9 +187,12 @@
   	    
   		TreeControlNode root =
               new TreeControlNode(folder.getName(),
  -                                null, folder.getTitle(locale),
  -                                PORTLET_URL,
  -                                null, true, "FOLDER_DOMAIN");
  +                                null, 
  +                                folder.getTitle(locale),
  +                                PortletApplicationResources.PORTLET_URL,
  +                                null, 
  +                                true, 
  +                                "FOLDER_DOMAIN");
   		
   		TreeControl control = new TreeControl(root);
   		
  @@ -223,7 +223,13 @@
               while (folderIter.hasNext())
               {
                   Folder childFolder = (Folder) folderIter.next();
  -                TreeControlNode childNode = new TreeControlNode(childFolder.getName(), null, childFolder.getTitle(locale), PORTLET_URL, null, false, "FOLDER_DOMAIN"  );
  +                TreeControlNode childNode = new TreeControlNode(childFolder.getName(), 
  +                                                                null, 
  +                                                                childFolder.getTitle(locale), 
  +                                                                PortletApplicationResources.PORTLET_URL, 
  +                                                                null, 
  +                                                                false, 
  +                                                                "FOLDER_DOMAIN"  );
                   parent.addChild(childNode);
                   buildFolderNodes(childFolder, childNode, locale);
               }
  @@ -251,7 +257,13 @@
   	        while (pageIter.hasNext())
   	        {
   	            Page page = (Page)pageIter.next();
  -	            TreeControlNode child = new TreeControlNode(page.getPath(), null, page.getTitle(locale), PORTLET_URL, null, false, "PAGE_DOMAIN"  );
  +	            TreeControlNode child = new TreeControlNode(page.getPath(), 
  +                                                            null, 
  +                                                            page.getTitle(locale), 
  +                                                            PortletApplicationResources.PORTLET_URL, 
  +                                                            null, 
  +                                                            false, 
  +                                                            "PAGE_DOMAIN"  );
   	            node.addChild(child);
   	        }
           }
  
  
  
  1.3       +1 -2      jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/SiteDetailPortlet.java
  
  Index: SiteDetailPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/SiteDetailPortlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SiteDetailPortlet.java	16 Sep 2004 23:01:02 -0000	1.2
  +++ SiteDetailPortlet.java	17 Sep 2004 00:18:58 -0000	1.3
  @@ -42,7 +42,6 @@
    */
   public class SiteDetailPortlet extends ServletPortlet
   {
  -
       private PortletContext context;
       private PageManager pageManager;
   
  
  
  
  1.4       +21 -3     jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/users/UserData.java
  
  Index: UserData.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/users/UserData.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UserData.java	16 Sep 2004 06:44:30 -0000	1.3
  +++ UserData.java	17 Sep 2004 00:18:58 -0000	1.4
  @@ -1,19 +1,37 @@
  +/*
  + * Copyright 2000-2004 The Apache Software Foundation.
  + * 
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + * 
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + * 
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   package org.apache.jetspeed.portlets.security.users;
   
   import java.security.Principal;
   import java.util.Iterator;
   
  -import javax.naming.Context;
  -import javax.naming.InitialContext;
   import javax.security.auth.Subject;
   
  -import org.apache.jetspeed.portlets.pam.PortletApplicationResources;
   import org.apache.jetspeed.security.User;
   import org.apache.jetspeed.security.UserManager;
   import org.apache.jetspeed.security.UserPrincipal;
   import org.apache.jetspeed.services.JetspeedPortletServices;
   import org.apache.jetspeed.services.PortletServices;
   
  +/**
  + * User data table bean (JSF).
  + *
  + * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  + * @version $Id$
  + */
   
   public class UserData
   {
  
  
  
  1.2       +21 -0     jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/users/TabbedPaneBean.java
  
  Index: TabbedPaneBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/users/TabbedPaneBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TabbedPaneBean.java	16 Sep 2004 06:36:09 -0000	1.1
  +++ TabbedPaneBean.java	17 Sep 2004 00:18:58 -0000	1.2
  @@ -1,7 +1,28 @@
  +/*
  + * Copyright 2000-2004 The Apache Software Foundation.
  + * 
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + * 
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + * 
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   package org.apache.jetspeed.portlets.security.users;
   
   import java.io.Serializable;
   
  +/**
  + * Tabbed bean state.
  + *
  + * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  + * @version $Id$
  + */
   public class TabbedPaneBean
           implements Serializable
   {
  
  
  
  1.2       +21 -1     jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/users/UserBean.java
  
  Index: UserBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/users/UserBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UserBean.java	15 Sep 2004 22:43:07 -0000	1.1
  +++ UserBean.java	17 Sep 2004 00:18:58 -0000	1.2
  @@ -1,6 +1,26 @@
  +/*
  + * Copyright 2000-2004 The Apache Software Foundation.
  + * 
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + * 
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + * 
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   package org.apache.jetspeed.portlets.security.users;
   
  -
  +/**
  + * User state.
  + *
  + * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  + * @version $Id$
  + */
   public class UserBean
   {
       private String first;
  
  
  
  1.3       +2 -6      jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/users/UserManagerPortlet.java
  
  Index: UserManagerPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/users/UserManagerPortlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UserManagerPortlet.java	16 Sep 2004 06:36:09 -0000	1.2
  +++ UserManagerPortlet.java	17 Sep 2004 00:18:58 -0000	1.3
  @@ -20,9 +20,7 @@
   import java.util.Iterator;
   
   import javax.naming.Context;
  -import javax.naming.InitialContext;
   import javax.portlet.PortletConfig;
  -import javax.portlet.PortletContext;
   import javax.portlet.PortletException;
   import javax.security.auth.Subject;
   
  @@ -44,15 +42,13 @@
    */
   public class UserManagerPortlet extends FacesPortlet
   {
  -    private PortletContext context;
       private UserManager userManager;
       
       public void init(PortletConfig config)
       throws PortletException 
       {
           super.init(config);
  -        context = getPortletContext();                
  -        userManager = (UserManager)context.getAttribute(PortletApplicationResources.CPS_USERMANAGER_COMPONENT);
  +        userManager = (UserManager)getPortletContext().getAttribute(PortletApplicationResources.CPS_USER_MANAGER_COMPONENT);
           if (null == userManager)
           {
               throw new PortletException("Failed to find the User Manager on portlet initialization");
  
  
  
  1.11      +28 -8     jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBrowser.java
  
  Index: PortletApplicationBrowser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBrowser.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PortletApplicationBrowser.java	16 Sep 2004 19:50:01 -0000	1.10
  +++ PortletApplicationBrowser.java	17 Sep 2004 00:18:59 -0000	1.11
  @@ -51,7 +51,6 @@
    */
   public class PortletApplicationBrowser extends ServletPortlet
   {
  -    private static final String PORTLET_URL = "portlet_url";
       private String template;
       private PortletContext context;
       private PortletRegistryComponent registry;
  @@ -152,29 +151,50 @@
   	    
   		TreeControlNode root =
               new TreeControlNode("ROOT-NODE",
  -                                null, "J2_ROOT",
  -                                PORTLET_URL,
  -                                null, true, "J2_DOMAIN");
  +                                null, 
  +                                "J2_ROOT",
  +                                PortletApplicationResources.PORTLET_URL,
  +                                null, 
  +                                true, 
  +                                "J2_DOMAIN");
   		
   		TreeControl control = new TreeControl(root);
   		
   		
   		TreeControlNode portletApps = 
  -			new TreeControlNode("APP_ROOT", null, "APP_ROOT", PORTLET_URL, null, false, "J2_DOMAIN");
  +			new TreeControlNode("APP_ROOT", 
  +                                null, 
  +                                "APP_ROOT", 
  +                                PortletApplicationResources.PORTLET_URL, 
  +                                null, 
  +                                false, 
  +                                "J2_DOMAIN");
   		root.addChild(portletApps);
   		
   		Iterator it = apps.iterator();
           while (it.hasNext())
           {
               MutablePortletApplication pa = (MutablePortletApplication)it.next();
  -            TreeControlNode appNode = new TreeControlNode(pa.getName(), null, pa.getName(), PORTLET_URL, null, false, "PA_APP_DOMAIN"  );
  +            TreeControlNode appNode = new TreeControlNode(pa.getName(), 
  +                                                          null, 
  +                                                          pa.getName(), 
  +                                                          PortletApplicationResources.PORTLET_URL, 
  +                                                          null, 
  +                                                          false, 
  +                                                          "PA_APP_DOMAIN"  );
               portletApps.addChild(appNode);
               
               Iterator pdefIter = pa.getPortletDefinitionList().iterator();
               while (pdefIter.hasNext())
               {
                   PortletDefinitionComposite portlet = (PortletDefinitionComposite) pdefIter.next();
  -                TreeControlNode portletNode = new TreeControlNode(portlet.getName(), null, portlet.getDisplayNameText(locale), PORTLET_URL, null, false, "PD_DOMAIN");
  +                TreeControlNode portletNode = new TreeControlNode(portlet.getName(), 
  +                                                                  null, 
  +                                                                  portlet.getDisplayNameText(locale), 
  +                                                                  PortletApplicationResources.PORTLET_URL, 
  +                                                                  null, 
  +                                                                  false, 
  +                                                                  "PD_DOMAIN");
                   appNode.addChild(portletNode);
               }
           }
  
  
  
  1.18      +1 -1      jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationDetail.java
  
  Index: PortletApplicationDetail.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationDetail.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- PortletApplicationDetail.java	16 Sep 2004 19:50:01 -0000	1.17
  +++ PortletApplicationDetail.java	17 Sep 2004 00:18:59 -0000	1.18
  @@ -1,6 +1,6 @@
   /*
 * Copyright 2000-2004 The Apache Software Foundation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.jetspeed.portlets.pam;
   
  -import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.StringTokenizer;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.PortletContext;
import javax.portlet.PortletException;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.apache.jetspeed.portlet.ServletPortlet;
import org.apache.jetspeed.portlets.pam.beans.PortletApplicationBean;
import org.apache.jetspeed.portlets.pam.beans.TabBean;
import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent;
import org.apache.jetspeed.om.common.GenericMetadata;
import org.apache.jetspeed.om.common.LocalizedField;
import org.apache.jetspeed.om.common.MutableDescription;
import org.apache.jetspeed.om.common.MutableLanguage;
import org.apache.jetspeed.om.common.ParameterComposite;
import org.apache.jetspeed.om.common.SecurityRoleRefComposite;
import org.apache.jetspeed.om.common.UserAttribute;
import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
import org.apache.jetspeed.om.common.preference.PreferenceComposite;
import org.apache.jetspeed.om.impl.LanguageImpl;
import org.apache.jetspeed.om.impl.SecurityRoleRefImpl;
import org.apache.jetspeed.om.impl.UserAttributeImpl;
import org.apache.jetspeed.om.portlet.impl.ContentTypeImpl;
import org.apache.pluto.om.common.SecurityRoleRef;
import org.apache.pluto.om.portlet.ContentType;

/**
 * This portlet is a browser over all the portlet applications in the system.
 *
 * @author <a href="mailto:jford@apache.com">Jeremy Ford</a>
 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
 * @version $Id$
 */
public class PortletApplicationDetail extends ServletPortlet
{
    private static final String PORTLET_ACTION = "portlet_action";
    private final String VIEW_PA = "portletApplication"; 
    private final String VIEW_PD = "portletDefinition";
    
    private static final String PORTLET_APP_ACTION_PREFIX = "portlet_app.";
    private static final String PORTLET_ACTION_PREFIX = "portlet.";

    private PortletContext context;
    private PortletRegistryComponent registry;
    private LinkedHashMap paTabMap = new LinkedHashMap();
    private LinkedHashMap pdTabMap = new LinkedHashMap();
    
    public void init(PortletConfig config)
    throws PortletException 
    {
        super.init(config);
        context = getPortletContext();
        registry = (PortletRegistryComponent)context.getAttribute(PortletApplicationResources.CPS_REGISTRY_COMPONENT);
        if (null == registry)
        {
            throw new PortletException("Failed to find the Portlet Registry on portlet initialization");
        }
        
        TabBean tb1 = new TabBean("pa_details");
        TabBean tb2 = new TabBean("pa_metadata");
        TabBean tb3 = new TabBean("pa_portlets");
        TabBean tb4 = new TabBean("pa_user_attribtues");
        
        paTabMap.put(tb1.getId(), tb1);
        paTabMap.put(tb2.getId(), tb2);
        paTabMap.put(tb3.getId(), tb3);
        paTabMap.put(tb4.getId(), tb4);
        
        TabBean tb_1 = new TabBean("pd_details");
        TabBean tb_2 = new TabBean("pd_metadata");
        TabBean tb_3 = new TabBean("pd_preferences");
        TabBean tb_4 = new TabBean("pd_languages");
        TabBean tb_5 = new TabBean("pd_parameters");
        TabBean tb_6 = new TabBean("pd_security");
        TabBean tb_7 = new TabBean("pd_content_type");
        
        pdTabMap.put(tb_1.getId(), tb_1);
        pdTabMap.put(tb_2.getId(), tb_2);
        pdTabMap.put(tb_3.getId(), tb_3);
        pdTabMap.put(tb_4.getId(), tb_4);
        pdTabMap.put(tb_5.getId(), tb_5);
        pdTabMap.put(tb_6.getId(), tb_6);
        pdTabMap.put(tb_7.getId(), tb_7);
    }
    
    public void doView(RenderRequest request, RenderResponse response)
  +import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.StringTokenizer;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.PortletContext;
import javax.portlet.PortletException;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.apache.jetspeed.portlet.ServletPortlet;
import org.apache.jetspeed.portlets.pam.beans.PortletApplicationBean;
import org.apache.jetspeed.portlets.pam.beans.TabBean;
import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent;
import org.apache.jetspeed.om.common.GenericMetadata;
import org.apache.jetspeed.om.common.LocalizedField;
import org.apache.jetspeed.om.common.MutableDescription;
import org.apache.jetspeed.om.common.MutableLanguage;
import org.apache.jetspeed.om.common.ParameterComposite;
import org.apache.jetspeed.om.common.SecurityRoleRefComposite;
import org.apache.jetspeed.om.common.UserAttribute;
import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
import org.apache.jetspeed.om.common.preference.PreferenceComposite;
import org.apache.jetspeed.om.impl.LanguageImpl;
import org.apache.jetspeed.om.impl.SecurityRoleRefImpl;
import org.apache.jetspeed.om.impl.UserAttributeImpl;
import org.apache.jetspeed.om.portlet.impl.ContentTypeImpl;
import org.apache.pluto.om.common.SecurityRoleRef;
import org.apache.pluto.om.portlet.ContentType;

/**
 * This portlet is a tabbed editor user interface for editing both portlet defintions
 * and portlet applications.
 *
 * @author <a href="mailto:jford@apache.com">Jeremy Ford</a>
 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
 * @version $Id$
 */
public class PortletApplicationDetail extends ServletPortlet
{
    private static final String PORTLET_ACTION = "portlet_action";
    private final String VIEW_PA = "portletApplication"; 
    private final String VIEW_PD = "portletDefinition";
    
    private static final String PORTLET_APP_ACTION_PREFIX = "portlet_app.";
    private static final String PORTLET_ACTION_PREFIX = "portlet.";

    private PortletContext context;
    private PortletRegistryComponent registry;
    private LinkedHashMap paTabMap = new LinkedHashMap();
    private LinkedHashMap pdTabMap = new LinkedHashMap();
    
    public void init(PortletConfig config)
    throws PortletException 
    {
        super.init(config);
        context = getPortletContext();
        registry = (PortletRegistryComponent)context.getAttribute(PortletApplicationResources.CPS_REGISTRY_COMPONENT);
        if (null == registry)
        {
            throw new PortletException("Failed to find the Portlet Registry on portlet initialization");
        }
        
        TabBean tb1 = new TabBean("pa_details");
        TabBean tb2 = new TabBean("pa_metadata");
        TabBean tb3 = new TabBean("pa_portlets");
        TabBean tb4 = new TabBean("pa_user_attribtues");
        
        paTabMap.put(tb1.getId(), tb1);
        paTabMap.put(tb2.getId(), tb2);
        paTabMap.put(tb3.getId(), tb3);
        paTabMap.put(tb4.getId(), tb4);
        
        TabBean tb_1 = new TabBean("pd_details");
        TabBean tb_2 = new TabBean("pd_metadata");
        TabBean tb_3 = new TabBean("pd_preferences");
        TabBean tb_4 = new TabBean("pd_languages");
        TabBean tb_5 = new TabBean("pd_parameters");
        TabBean tb_6 = new TabBean("pd_security");
        TabBean tb_7 = new TabBean("pd_content_type");
        
        pdTabMap.put(tb_1.getId(), tb_1);
        pdTabMap.put(tb_2.getId(), tb_2);
        pdTabMap.put(tb_3.getId(), tb_3);
        pdTabMap.put(tb_4.getId(), tb_4);
        pdTabMap.put(tb_5.getId(), tb_5);
        pdTabMap.put(tb_6.getId(), tb_6);
        pdTabMap.put(tb_7.getId(), tb_7);
    }
    
    public void doView(RenderRequest request, RenderResponse response)
       throws PortletException, IOException
       {
        response.setContentType("text/html");
        
        String paName = (String)
        	request.getPortletSession().getAttribute(PortletApplicationResources.PAM_CURRENT_PA, 
                                             PortletSession.APPLICATION_SCOPE);
        
        MutablePortletApplication pa = registry.getPortletApplication(paName);
        
        if (null != pa)
        {
            request.setAttribute(VIEW_PA, new PortletApplicationBean(pa));
            
            String pdefName = (String) request.getPortletSession().getAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, PortletSession.APPLICATION_SCOPE);
            PortletDefinitionComposite pdef = (PortletDefinitionComposite) pa.getPortletDefinitionByName(pdefName);
            
            request.setAttribute(VIEW_PD, pdef);
            
            request.setAttribute("tabs", paTabMap.values());
            request.setAttribute("portlet_tabs", pdTabMap.values());
            
            TabBean selectedTab = (TabBean) request.getPortletSession().getAttribute(PortletApplicationResources.REQUEST_SELECT_TAB, PortletSession.APPLICATION_SCOPE);
            if(selectedTab == null)
            {
                selectedTab = (TabBean) paTabMap.values().iterator().next();
            }
            
            //this supports tabs for portlets
            if(selectedTab.getId().equals("pa_portlets"))
            {
                TabBean selectedPortletTab = (TabBean) request.getPortletSession().getAttribute("selected_portlet_tab");
                if(selectedPortletTab == null)
                {
                    selectedPortletTab = (TabBean) pdTabMap.values().iterator().next();
                }
                request.setAttribute("selected_portlet_tab", selectedPortletTab);
            }
            
            request.setAttribute(PortletApplicationResources.REQUEST_SELECT_TAB, selectedTab);
            
        }
           super.doView(request, response);
  
  
  
  1.6       +8 -5      jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationResources.java
  
  Index: PortletApplicationResources.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationResources.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PortletApplicationResources.java	16 Sep 2004 21:24:15 -0000	1.5
  +++ PortletApplicationResources.java	17 Sep 2004 00:18:59 -0000	1.6
  @@ -23,13 +23,16 @@
    */
   public final class PortletApplicationResources
   {
  +    public final static String PORTLET_URL = "portlet_url";
       public final static String REQUEST_SELECT_NODE = "select_node";
       public final static String REQUEST_SELECT_PORTLET = "select_portlet";
       public final static String REQUEST_SELECT_TAB = "selected_tab";
       public final static String PAM_CURRENT_PA = "org.apache.jetspeed.pam.pa";
       public final static String CPS_REGISTRY_COMPONENT = "cps:PortletRegistryComponent";
  -    public final static String CPS_USERMANAGER_COMPONENT = "cps:UserManager";
  -    public static final String CPS_PAGE_MANAGER_COMPONENT = "cps:PageManager";
  -    public static final String CURRENT_FOLDER = "current_folder";
  -    public static final String CURRENT_PAGE = "current_page";    
  +    public final static String CPS_USER_MANAGER_COMPONENT = "cps:UserManager";
  +    public final static String CPS_PAGE_MANAGER_COMPONENT = "cps:PageManager";
  +    public final static String CURRENT_FOLDER = "current_folder";
  +    public final static String CURRENT_PAGE = "current_page";
  +    public final static String CURRENT_USER = "current_user";
  +    public final static String PAM_CURRENT_USER = "org.apache.jetspeed.pam.user";    
   }
  
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/UserBrowserPortlet.java
  
  Index: UserBrowserPortlet.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.portlets.security;
  
  import java.io.IOException;
  import java.security.Principal;
  import java.util.Iterator;
  import java.util.Locale;
  
  import javax.portlet.ActionRequest;
  import javax.portlet.ActionResponse;
  import javax.portlet.PortletConfig;
  import javax.portlet.PortletException;
  import javax.portlet.RenderRequest;
  import javax.portlet.RenderResponse;
  import javax.security.auth.Subject;
  
  import org.apache.jetspeed.portlet.ServletPortlet;
  import org.apache.jetspeed.portlets.pam.PortletApplicationResources;
  import org.apache.jetspeed.security.User;
  import org.apache.jetspeed.security.UserManager;
  import org.apache.jetspeed.security.UserPrincipal;
  import org.apache.webapp.admin.TreeControl;
  import org.apache.webapp.admin.TreeControlNode;
  
  /**
   * This portlet is a browser over all the portlet applications in the system.
   *
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: UserBrowserPortlet.java,v 1.1 2004/09/17 00:18:59 taylor Exp $
   */
  public class UserBrowserPortlet extends ServletPortlet
  {
      private UserManager manager;
      
      public void init(PortletConfig config)
      throws PortletException 
      {
          super.init(config);                       
          manager = (UserManager)getPortletContext().getAttribute(PortletApplicationResources.CPS_USER_MANAGER_COMPONENT);
          if (null == manager)
          {
              throw new PortletException("Failed to find the User Manager on portlet initialization");
          }
      }
      
      public void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException
      {
          response.setContentType("text/html");
          
          TreeControl control = (TreeControl) request.getPortletSession().getAttribute("j2_tree");
          if(control == null)
          {
              Iterator users = manager.getUsers("");
              control = buildTree(users, request.getLocale());
              request.getPortletSession().setAttribute("j2_tree", control);
          }
          request.setAttribute("j2_tree", control);
          
          super.doView(request, response);
          
      }
  
      public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
      {
          TreeControl control = (TreeControl) actionRequest.getPortletSession().getAttribute("j2_tree");
          //assert control != null
          if(control != null)
          {
              String node = actionRequest.getParameter("node");
              if(node != null)
              {
                  TreeControlNode controlNode = control.findNode(node);
                  if(controlNode != null)
                  {
                      controlNode.setExpanded(!controlNode.isExpanded());
                  }
              }
              
              String selectedNode = actionRequest.getParameter(PortletApplicationResources.REQUEST_SELECT_NODE);
              if(selectedNode != null)
              {
                  control.selectNode(selectedNode);
                  TreeControlNode child = control.findNode(selectedNode);
                  if(child != null)
                  {
                      User user = null;
                      
                      String domain = child.getDomain();
                      if(domain.equals("USER_DOMAIN"))
                      {
                          System.out.println("SELECTED NODE = " + selectedNode);
                          /*pa = registry.getPortletApplicationByIdentifier(selectedNode);
                          if(pa != null)
                          {
                              actionRequest.getPortletSession().removeAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, PortletSession.APPLICATION_SCOPE);
                          }*/
                      }
                      else
                      {
                          //warn about not recognized domain
                      }
                      
                      if (user != null)
                      {
                          // actionRequest.getPortletSession().setAttribute(PortletApplicationResources.PAM_CURRENT_PA, pa.getName(), PortletSession.APPLICATION_SCOPE);
                      }
                  }
              }
          }
      }
      
      
      private TreeControl buildTree(Iterator users, Locale locale) 
      {       
          TreeControlNode root =
              new TreeControlNode("SECURITY-NODE",
                                  null, "SECURITY_ROOT",
                                  PortletApplicationResources.PORTLET_URL,
                                  null, true, "SECURITY_DOMAIN");
          
          TreeControl control = new TreeControl(root);
          
          
          TreeControlNode userTree = 
              new TreeControlNode("USER_ROOT", 
                                  null, 
                                  "USER_ROOT", 
                                  PortletApplicationResources.PORTLET_URL, 
                                  null, 
                                  false, 
                                  "SECURITY_DOMAIN");
          root.addChild(userTree);
          
          while (users.hasNext())
          {
              User user = (User)users.next();
              Principal principal = getPrincipal(user.getSubject(), UserPrincipal.class);
              
              TreeControlNode userNode = new TreeControlNode(principal.getName(), 
                                                             null, 
                                                             principal.getName(), 
                                                             PortletApplicationResources.PORTLET_URL, 
                                                             null, 
                                                             false, 
                                                             "USER_APP_DOMAIN");
              userTree.addChild(userNode);            
          }
                  
          return control;
      }
  
      private Principal getPrincipal(Subject subject, Class classe)
      {
          Principal principal = null;
          Iterator principals = subject.getPrincipals().iterator();
          while (principals.hasNext())
          {
              Principal p = (Principal) principals.next();
              if (classe.isInstance(p))
              {
                  principal = p;
                  break;
              }
          }
          return principal;
      }
      
  }
  
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/UserDetailsPortlet.java
  
  Index: UserDetailsPortlet.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.portlets.security;
  
  import java.io.IOException;
  import java.util.LinkedHashMap;
  
  import javax.portlet.PortletConfig;
  import javax.portlet.PortletException;
  import javax.portlet.PortletSession;
  import javax.portlet.RenderRequest;
  import javax.portlet.RenderResponse;
  
  import org.apache.jetspeed.portlet.ServletPortlet;
  import org.apache.jetspeed.portlets.pam.PortletApplicationResources;
  import org.apache.jetspeed.portlets.pam.beans.TabBean;
  import org.apache.jetspeed.security.User;
  import org.apache.jetspeed.security.UserManager;
  
  /**
   * This portlet is a tabbed editor user interface for editing user attributes
   * and security definitions.
   *
   * @author <a href="mailto:jford@apache.com">Jeremy Ford</a>
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: UserDetailsPortlet.java,v 1.1 2004/09/17 00:18:59 taylor Exp $
   */
  public class UserDetailsPortlet extends ServletPortlet
  {
      private static final String PORTLET_ACTION = "portlet_action";
      private final String VIEW_USER = "user"; 
      
      private static final String PORTLET_APP_ACTION_PREFIX = "portlet_app.";
      private static final String PORTLET_ACTION_PREFIX = "portlet.";
  
      private UserManager manager;
  
      private LinkedHashMap userTabMap = new LinkedHashMap();
      
      public void init(PortletConfig config)
      throws PortletException 
      {
          super.init(config);
          manager = (UserManager)getPortletContext().getAttribute(PortletApplicationResources.CPS_USER_MANAGER_COMPONENT);
          if (null == manager)
          {
              throw new PortletException("Failed to find the User Manager on portlet initialization");
          }
          
          TabBean tb1 = new TabBean("user_attributes");
          TabBean tb2 = new TabBean("user_security");
          
          userTabMap.put(tb1.getId(), tb1);
          userTabMap.put(tb2.getId(), tb2);
          
      }
      
      public void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException
      {
          response.setContentType("text/html");
          
          String userName = (String)
              request.getPortletSession().getAttribute(PortletApplicationResources.PAM_CURRENT_USER,
                                                       PortletSession.APPLICATION_SCOPE);
          User user;
          try
          {
              user = manager.getUser(userName);
          }
          catch (Exception e)
          {
              throw new PortletException(e);
          }
          
          if (null != user)
          {
              request.setAttribute(VIEW_USER, user); // TODO: bean
                          
              request.setAttribute("tabs", userTabMap.values());
              
              TabBean selectedTab = (TabBean) request.getPortletSession().getAttribute(PortletApplicationResources.REQUEST_SELECT_TAB, PortletSession.APPLICATION_SCOPE);
              if(selectedTab == null)
              {
                  selectedTab = (TabBean) userTabMap.values().iterator().next();
              }
                          
              request.setAttribute(PortletApplicationResources.REQUEST_SELECT_TAB, selectedTab);
              
          }
          super.doView(request, response);
      }
      
  
  }
  
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/security/resources/SecurityResources.properties
  
  Index: SecurityResources.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: SecurityResources.properties,v 1.1 2004/09/17 00:18:59 taylor Exp $
  #
  
  user.details.name=Name
  user.details.name.description=The Name of this item
  
  user.details.description=Description
  user.details.description.description=A descriptive phrase for this item
  
  user.details.value=Value
  user.details.value.description=The value for this item
  
  user.details.locale=Locale
  user.details.locale.description=A valid 2 letter country code
  
  user.details.version=Version
  user.details.type=Type
  user.details.type.webapp=WEBAPP
  user.details.type.local=Local
  user.details.id=ID
  user.details.services=Services
  
  user.details.choose_portlet=Please Chooose a Portlet
  user.details.edit=Edit
  user.details.remove=Remove Selected
  user.details.add_user_attribute=Add User Attribute
  
  ##Metadata view
  user.details.add_metadata=Add MetaData
  
  ##Portlet view
  user.details.expiration_cache=Expiration Cache
  user.details.unique_name=Unique Name
  user.details.preference_validator=Preference Validator
  user.details.class_name=Class Name
  
  ##Preference view
  user.details.add_preference=Add Preference
  
  ##Language view
  user.details.title=Title
  user.details.short_title=Short Title
  user.details.keyword=Keyword
  user.details.title.description=Title to appear in title bar
  user.details.short_title.description=A short descriptive title
  user.details.keyword.description=Comma delimited list of keywords
  user.details.add_language=Add Language
  
  ##Parameter View
  user.details.add_parameter=Add Parameter
  
  ##Security View
  user.details.role_name=Role Name
  user.details.role_name.description=The name of the role
  
  user.details.role_link=Role Link
  user.details.role_link.description=The id of the role link
  
  user.details.add_security=Add Security
  
  ##Content Type View
  user.details.content_type=Content Type
  user.details.content_type.description=MimeType like text/html.  Wildcards are allowed.
  
  user.details.modes=Modes
  user.details.portlet_mode=Portlet Mode
  user.details.porltet_mode.view=View
  user.details.porltet_mode.edit=Edit
  user.details.porltet_mode.help=Help
  user.details.portlet_mode.description=Standard portlet modes that the portlet supports
  
  user.details.custom_mode=Custom Modes
  user.details.custom_modes.description=Custom Modes that the portlet supports
  
  user.details.add_content_type=Add Content Type
  
  ##Portlet Application Tabs
  user.details.tabs.pa_details=Details
  user.details.tabs.pa_metadata=MetaData
  user.details.tabs.pa_portlets=Portlets
  user.details.tabs.pa_user_attribtues=User Attributes
  
  ##Portlet Definition Tabs
  user.details.tabs.pd_details=Details
  user.details.tabs.pd_metadata=MetaData
  user.details.tabs.pd_preferences=Preferences
  user.details.tabs.pd_languages=Languages
  user.details.tabs.pd_parameters=Parameters
  user.details.tabs.pd_security=Security
  user.details.tabs.pd_content_type=Content Type
  
  
  
  
  

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