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 2005/04/22 07:46:58 UTC

cvs commit: jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/security/users user-browser.vm user-details.jsp

taylor      2005/04/21 22:46:58

  Modified:    applications/security/src/java/org/apache/jetspeed/portlets/security/users
                        UserDetailsPortlet.java UserChooserPortlet.java
               applications/security/src/webapp/WEB-INF portlet.xml
               applications/security/src/webapp/WEB-INF/security/users
                        user-details.jsp
  Added:       applications/security/src/java/org/apache/jetspeed/portlets/security/users
                        UserBrowser.java
               applications/security/src/java/org/apache/jetspeed/portlets/security
                        AbstractSecurityBrowser.java
               applications/security/src/webapp/WEB-INF/security/users
                        user-browser.vm
  Log:
  http://issues.apache.org/jira/browse/JS2-237
  not completed, just a checkpoint for Ate to review new user administration
  havent' started on groups, roles
  user management todo:
  - r u sure on delete
  - popups for roles, groups, profile (not dropdown list)
  - help mode
  - edit mode
  -- formatting
  - error handling
  - Ate's feature requests...
  
  Revision  Changes    Path
  1.5       +89 -43    jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserDetailsPortlet.java
  
  Index: UserDetailsPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserDetailsPortlet.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UserDetailsPortlet.java	27 Mar 2005 23:33:17 -0000	1.4
  +++ UserDetailsPortlet.java	22 Apr 2005 05:46:58 -0000	1.5
  @@ -33,7 +33,6 @@
   import javax.portlet.PortletConfig;
   import javax.portlet.PortletException;
   import javax.portlet.PortletRequest;
  -import javax.portlet.PortletSession;
   import javax.portlet.RenderRequest;
   import javax.portlet.RenderResponse;
   import javax.security.auth.Subject;
  @@ -160,14 +159,12 @@
       {
           response.setContentType("text/html");
           
  -        String userName = (String)
  -            request.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER, 
  -                                         PortletSession.APPLICATION_SCOPE);
  +        String userName = (String)PortletMessaging.receive(request, 
  +                                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
   
           User user = null;
           if (userName != null)
           {
  -            // TODO: don't lookup with every view call
               user = lookupUser(userName);
           }
           
  @@ -316,7 +313,7 @@
   
       public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) 
           throws PortletException, IOException
  -    {                        
  +    {   
           String selectedTab = actionRequest.getParameter(SecurityResources.REQUEST_SELECT_TAB);
           if (selectedTab != null)
           {
  @@ -332,6 +329,14 @@
           {
               removeUser(actionRequest, actionResponse);
           }
  +        else if (action != null && action.equals("add.new.user"))
  +        {
  +            PortletMessaging.cancel(actionRequest, UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
  +        }
  +        else if (action != null && action.equals("add.user"))
  +        {
  +            addUser(actionRequest);
  +        }
           else if (action != null && isUserPortletAction(action))
           {
               action = getAction(USER_ACTION_PREFIX, action);                
  @@ -400,9 +405,8 @@
       public void removeUser(ActionRequest actionRequest, ActionResponse actionResponse) 
       throws PortletException
       {
  -        String userName = (String)
  -            actionRequest.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER, 
  -                             PortletSession.APPLICATION_SCOPE);
  +        String userName = (String)PortletMessaging.receive(actionRequest, 
  +                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);        
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -438,9 +442,8 @@
       {
           ResourceBundle bundle = ResourceBundle.getBundle("org.apache.jetspeed.portlets.security.resources.UsersResources",actionRequest.getLocale());
   
  -        String userName = (String)
  -        actionRequest.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER, 
  -                             PortletSession.APPLICATION_SCOPE);
  +        String userName = (String)PortletMessaging.receive(actionRequest, 
  +                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -499,9 +502,8 @@
       
       private void updateUserAttribute(ActionRequest actionRequest, ActionResponse actionResponse)
       {
  -        String userName = (String)
  -            actionRequest.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER, 
  -                                 PortletSession.APPLICATION_SCOPE);
  +        String userName = (String)PortletMessaging.receive(actionRequest, 
  +                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -520,10 +522,8 @@
       
       private void addUserAttribute(ActionRequest actionRequest, ActionResponse actionResponse)
       {
  -        String userName = (String)
  -            actionRequest.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER, 
  -                                     PortletSession.APPLICATION_SCOPE);
  -        
  +        String userName = (String)PortletMessaging.receive(actionRequest, 
  +                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);        
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -539,9 +539,8 @@
   
       private void removeUserAttributes(ActionRequest actionRequest, ActionResponse actionResponse)
       {
  -        String userName = (String)
  -            actionRequest.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER, 
  -                                     PortletSession.APPLICATION_SCOPE);
  +        String userName = (String)PortletMessaging.receive(actionRequest, 
  +                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);        
           List deletes = new LinkedList();
           
           User user = lookupUser(userName);
  @@ -580,9 +579,8 @@
       
       private void removeUserRoles(ActionRequest actionRequest, ActionResponse actionResponse)
       {
  -        String userName = (String)
  -            actionRequest.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER, 
  -                                     PortletSession.APPLICATION_SCOPE);
  +        String userName = (String)PortletMessaging.receive(actionRequest, 
  +                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -612,10 +610,8 @@
       
       private void addUserRole(ActionRequest actionRequest, ActionResponse actionResponse)
       {
  -        String userName = (String)
  -            actionRequest.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER, 
  -                                     PortletSession.APPLICATION_SCOPE);
  -        
  +        String userName = (String)PortletMessaging.receive(actionRequest, 
  +                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);       
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -638,9 +634,8 @@
       
       private void removeUserGroups(ActionRequest actionRequest, ActionResponse actionResponse)
       {
  -        String userName = (String)
  -            actionRequest.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER, 
  -                                     PortletSession.APPLICATION_SCOPE);
  +        String userName = (String)PortletMessaging.receive(actionRequest, 
  +                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -670,10 +665,8 @@
       
       private void addUserGroup(ActionRequest actionRequest, ActionResponse actionResponse)
       {
  -        String userName = (String)
  -            actionRequest.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER, 
  -                                     PortletSession.APPLICATION_SCOPE);
  -        
  +        String userName = (String)PortletMessaging.receive(actionRequest, 
  +                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -777,9 +770,8 @@
   
       private void addUserProfile(ActionRequest actionRequest, ActionResponse actionResponse)
       {
  -        String userName = (String)
  -            actionRequest.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER, 
  -                                     PortletSession.APPLICATION_SCOPE);
  +        String userName = (String)PortletMessaging.receive(actionRequest, 
  +                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -807,9 +799,8 @@
       
       private void removeUserProfile(ActionRequest actionRequest, ActionResponse actionResponse)
       {
  -        String userName = (String)
  -            actionRequest.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER, 
  -                                     PortletSession.APPLICATION_SCOPE);
  +        String userName = (String)PortletMessaging.receive(actionRequest, 
  +                UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_SELECTED);
           User user = lookupUser(userName);
           if (user != null)
           {
  @@ -843,4 +834,59 @@
               }                                    
           }
       }        
  +    
  +    private void addUser(ActionRequest actionRequest)
  +    {
  +        String userName = actionRequest.getParameter("jetspeed.user");
  +        String password = actionRequest.getParameter("jetspeed.password");            
  +        if (!isEmpty(userName) && !isEmpty(password)) 
  +        {
  +            try
  +            {            
  +                userManager.addUser(userName, password);
  +                PortletMessaging.publish(actionRequest, UserBrowser.TOPIC_USERS, UserBrowser.MESSAGE_REFRESH, "true");
  +                
  +                
  +//                User user = userManager.getUser(userName);
  +//                String role = actionRequest.getParameter(ROLES_CONTROL);
  +//                if (!isEmpty(role) && user != null) 
  +//                {
  +//                    roleManager.addRoleToUser(userName, role);
  +//                }
  +//
  +//                String rule = actionRequest.getParameter(RULES_CONTROL);
  +//                if (!isEmpty(rule) && user != null) 
  +//                {
  +//                    Principal principal = getPrincipal(user.getSubject(), UserPrincipal.class);                         
  +//                    profiler.setRuleForPrincipal(principal, profiler.getRule(rule), "page");
  +//                }
  +                
  +            }
  +            catch (Exception se)
  +            {
  +                try
  +                {
  +                    PortletMessaging.publish(actionRequest, "user.error", se.getMessage());
  +                }
  +                catch (Exception e)
  +                {
  +                }
  +            }
  +            
  +        }
  +                    
  +        
  +        return;
  +        
  +    }
  +    
  +    private boolean isEmpty(String s)
  +    {
  +        if (s == null) return true;
  +        
  +        if (s.trim().equals("")) return true;
  +        
  +        return false;
  +    }
  +    
   }
  
  
  
  1.3       +4 -16     jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserChooserPortlet.java
  
  Index: UserChooserPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserChooserPortlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UserChooserPortlet.java	13 Jan 2005 06:13:16 -0000	1.2
  +++ UserChooserPortlet.java	22 Apr 2005 05:46:58 -0000	1.3
  @@ -25,6 +25,7 @@
   import javax.portlet.RenderRequest;
   import javax.security.auth.Subject;
   
  +import org.apache.jetspeed.portlets.security.AbstractSecurityBrowser;
   import org.apache.jetspeed.portlets.security.SecurityResources;
   import org.apache.jetspeed.security.User;
   import org.apache.jetspeed.security.UserManager;
  @@ -39,7 +40,7 @@
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
    * @version $Id$
    */
  -public class UserChooserPortlet extends BrowserPortlet
  +public class UserChooserPortlet extends AbstractSecurityBrowser
   {
       private UserManager userManager;
       
  @@ -90,18 +91,5 @@
               throw e;
           }        
       }
  -   
  -    public 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/security/src/java/org/apache/jetspeed/portlets/security/users/UserBrowser.java
  
  Index: UserBrowser.java
  ===================================================================
  /* Copyright 2004 Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
  package org.apache.jetspeed.portlets.security.users;
  
  import java.io.IOException;
  import java.security.Principal;
  import java.sql.Types;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  import javax.portlet.ActionRequest;
  import javax.portlet.ActionResponse;
  import javax.portlet.PortletConfig;
  import javax.portlet.PortletException;
  import javax.portlet.PortletMode;
  import javax.portlet.RenderRequest;
  import javax.portlet.RenderResponse;
  
  import org.apache.jetspeed.portlets.security.AbstractSecurityBrowser;
  import org.apache.jetspeed.portlets.security.SecurityResources;
  import org.apache.jetspeed.security.User;
  import org.apache.jetspeed.security.UserManager;
  import org.apache.jetspeed.security.UserPrincipal;
  import org.apache.portals.gems.browser.BrowserIterator;
  import org.apache.portals.gems.browser.DatabaseBrowserIterator;
  import org.apache.portals.gems.util.StatusMessage;
  import org.apache.portals.messaging.PortletMessaging;
  import org.apache.velocity.context.Context;
  
  /**
   * Role Browser - flat non-hierarchical view
   * 
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: UserBrowser.java,v 1.1 2005/04/22 05:46:58 taylor Exp $
   */
  public class UserBrowser extends AbstractSecurityBrowser
  {
      private UserManager userManager;
      
      public static final String TOPIC_USERS = "UserBrowser";
      public static final String MESSAGE_SELECTED = "selected";
      public static final String MESSAGE_STATUS = "status";
      public static final String MESSAGE_REFRESH = "refresh";
          
      public void init(PortletConfig config)
      throws PortletException 
      {
          super.init(config);
          userManager = (UserManager) 
              getPortletContext().getAttribute(SecurityResources.CPS_USER_MANAGER_COMPONENT);
          if (null == userManager)
          {
              throw new PortletException("Failed to find the User Manager on portlet initialization");
          }
      }
  
      public void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException
      {
          String selected = (String)PortletMessaging.receive(request, TOPIC_USERS, MESSAGE_SELECTED);
          if (selected != null)
          {        
              Context context = this.getContext(request);
              context.put(SELECTED, selected);
          }
          StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, TOPIC_USERS, MESSAGE_STATUS);
          if (msg != null)
          {
              this.getContext(request).put(STATUS, msg);            
          }
          String refresh = (String)PortletMessaging.consume(request, TOPIC_USERS, MESSAGE_REFRESH); 
          if (refresh != null)
          {        
              this.clearBrowserIterator(request);
          }
          
          super.doView(request, response);
      }
      
      public void processAction(ActionRequest request, ActionResponse response)
      throws PortletException, IOException
      {
          if (request.getPortletMode() == PortletMode.VIEW)
          {
              String selected = request.getParameter("user");
              if (selected != null)
              {
                  PortletMessaging.publish(request, TOPIC_USERS, MESSAGE_SELECTED, selected);
              }
          }
          super.processAction(request, response);
              
      }
  
      
      
      public void getRows(RenderRequest request, String sql, int windowSize)
      throws Exception
      {
          List resultSetTitleList = new ArrayList();
          List resultSetTypeList = new ArrayList();
          try
          {
              Iterator users = userManager.getUsers("");
                          
              
              resultSetTypeList.add(String.valueOf(Types.VARCHAR));
              resultSetTitleList.add("User");
  
              List list = new ArrayList();
              while (users.hasNext())
              {
                  User user = (User)users.next();
                  Principal principal = getPrincipal(user.getSubject(),
                          UserPrincipal.class);                
                  list.add(principal.getName());
              }            
              BrowserIterator iterator = new DatabaseBrowserIterator(
                      list, resultSetTitleList, resultSetTypeList,
                      windowSize);
              setBrowserIterator(request, iterator);
              iterator.sort("User");
          }
          catch (Exception e)
          {
              //log.error("Exception in CMSBrowserAction.getRows: ", e);
              e.printStackTrace();
              throw e;
          }        
      }
      
  }
  
  
  
  1.1                  jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/AbstractSecurityBrowser.java
  
  Index: AbstractSecurityBrowser.java
  ===================================================================
  /* Copyright 2004 Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
  package org.apache.jetspeed.portlets.security;
  
  import java.security.Principal;
  import java.util.Iterator;
  
  import javax.security.auth.Subject;
  
  import org.apache.portals.gems.browser.BrowserPortlet;
  
  
  /**
   * Abstract Security Browser - factored out common functionality for security browsers 
   * 
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: AbstractSecurityBrowser.java,v 1.1 2005/04/22 05:46:58 taylor Exp $
   */
  public abstract class AbstractSecurityBrowser extends BrowserPortlet
  {
      public static final String STATUS = "statusMsg";
      public static final String SELECTED = "selected";
      
      public 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.15      +8 -2      jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/portlet.xml
  
  Index: portlet.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/portlet.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- portlet.xml	21 Jan 2005 22:09:22 -0000	1.14
  +++ portlet.xml	22 Apr 2005 05:46:58 -0000	1.15
  @@ -94,12 +94,12 @@
       <init-param>
       	<description>This parameter sets the template used in view mode.</description>
   		<name>ViewPage</name>
  -			<value>/WEB-INF/security/users/user-browser.jsp</value>
  +			<value>/WEB-INF/security/users/user-browser.vm</value>
        </init-param>   
       <portlet-name>UserBrowserPortlet</portlet-name>
       <display-name>User Browser</display-name>
       <description>The User Browser displays a list of users managed in this portal. From here you can add, edit, and users.</description>
  -    <portlet-class>org.apache.jetspeed.portlets.security.users.UserBrowserPortlet</portlet-class>
  +    <portlet-class>org.apache.jetspeed.portlets.security.users.UserBrowser</portlet-class>
       <expiration-cache>-1</expiration-cache>
       <supports>
         <mime-type>text/html</mime-type>
  @@ -114,6 +114,12 @@
         <short-title>Users</short-title>
         <keywords>admin,security,users</keywords>
       </portlet-info>
  +    <portlet-preferences>
  +      <preference>                            
  +        <name>WindowSize</name>                    
  +        <value>10</value>    
  +      </preference>                               		    
  +    </portlet-preferences>                    
     </portlet>
   
   <portlet id="UserDetailsPortlet">
  
  
  
  1.9       +76 -5     jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/security/users/user-details.jsp
  
  Index: user-details.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/security/users/user-details.jsp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- user-details.jsp	27 Mar 2005 23:33:17 -0000	1.8
  +++ user-details.jsp	22 Apr 2005 05:46:58 -0000	1.9
  @@ -402,19 +402,90 @@
   </c:if>
   <%--End of Profile tab data--%>
   
  +<table>
  +<tr>
  +<td>
  +<portlet:actionURL var="addUser" />
  +<form action="<c:out value="${addUser}"/>" method="post">
  +<input type="hidden" name="portlet_action" value="add.new.user"/>
  +<input type="submit" value="Add New User" class="portlet-form-button"/>
  +</form>
  +</td>
  +<td>
   <portlet:actionURL var="removeUser" />
   <form action="<c:out value="${removeUser}"/>" method="post">
   <input type="hidden" name="portlet_action" value="remove.user"/>
  -<br/>
   <input type="submit" value="Remove User" class="portlet-form-button"/>
   </form>
  +</td>
  +</tr>
  +</table>
  +<%--End of User check --%>
  +</c:if>
   
  -<br />
  -<br />
  +<%-- Add New User --%>
  +<c:if test="${user == null}">
   
  -<%--End of User check --%>
  +<h3 class="portlet-section-subheader">Add User</h3>
  +<div class="portlet-section-text">
  +<portlet:actionURL var="addUser" />
  +
  +<form action="<c:out value="${addUser}"/>" method="post">
  +<input type='hidden' name='portlet_action' value='add.user'/>
  +<table>
  +  <tr colspan="2" align="right">
  +    <td nowrap class="portlet-section-alternate" align="right">New User Name:&nbsp;</td>
  +    <td class="portlet-section-body" align="left">
  +      <input type="text" name="jetspeed.user" size="30" value="" class="portlet-form-field-label">
  +    </td>
  +  </tr>
  +  <tr colspan="2" align="right">
  +    <td nowrap class="portlet-section-alternate" align="right">Password:&nbsp;</td>
  +    <td class="portlet-section-body" align="left">
  +      <input type="password" name="jetspeed.password" size="30" value="" class="portlet-form-field-label">
  +    </td>
  +  </tr>
  +  
  +  <!-- Select Roles -->
  +  <tr colspan="2" align="right">
  +    <td nowrap class="portlet-section-alternate" align="right">Default Role:&nbsp;</td>
  +    <td class="portlet-section-body" align="left">
  + 		<select name="jetspeedRoles" class="portlet-form-field-label">		
  +			<option value=""/> 		 		
  +			<c:forEach var="roleName" items="${jetspeedRoles}">			    
  +			    <option value="<c:out value='${roleName}'/>"
  +  			    <c:if test="${roleName == 'user'}">selected="true"</c:if>>			    
  +				  <c:out value="${roleName}"/>
  +			    </option>
  +			</c:forEach>
  +		</select>      
  +    </td>
  +  </tr>
  +
  +  <!-- Select Profiling Rules -->
  +  <tr colspan="2" align="right">
  +    <td nowrap class="portlet-section-alternate" align="right">Profiling Rule:&nbsp;</td>
  +    <td class="portlet-section-body" align="left">
  + 		<select name="jetspeedRules" class="portlet-form-field-label">		
  +			<option value=""/> 		
  +			<c:forEach var="ruleName" items="${jetspeedRules}">
  +			    <option value="<c:out value='${ruleName}'/>"
  +  			    <c:if test="${ruleName == 'role-fallback'}">selected="true"</c:if>>
  +				  <c:out value="${ruleName}"/>
  +			    </option>
  +			</c:forEach>
  +		</select>      
  +    </td>
  +  </tr>
  +  
  +</table>
  +<br/>
  +<input type="submit" value="Add User" class="portlet-form-button"/>
  +</form>
  +<c:if test="${errorMessage != null}">
  +  <li style="color:red"><c:out value="${errorMessage}"/></li>
   </c:if>
  -<br />
   
  +</c:if>
   
   
  
  
  
  1.1                  jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/security/users/user-browser.vm
  
  Index: user-browser.vm
  ===================================================================
  <script language='JavaScript' src='/idtb/scripts/idtb.js'></script>
  
  #set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
  
  #if ($statusMsg)
  #parse ('/WEB-INF/view/status-include.vm')
  #end
  
  <table cellpadding=0 cellspacing=1 border=0 width='100%' >
    <tr>
       <th width='12'></th>
      #foreach ($column in $title)      
        <th align='center' class="portlet-section-header" width="100%" nowrap>
          $column
        </th>
      #end
    </tr>
    #foreach ( $user in $table )
    <tr>
      #if ($velocityCount % 2 == 0)
         #set($rowstyle = "portlet-section-body")
      #else
         #set($rowstyle = "portlet-section-alternate")
      #end  
  	#set ($action = $renderResponse.createActionURL())
  	$action.setParameter("user", $user)           
  	   #if ($selected == $user)
         <td class="$rowstyle" nowrap width='12'>
           <img src="/security/images/selected.gif" />
         </td>	 	
         #else
         <td class="$rowstyle" nowrap width='12'>
           &nbsp;
         </td>             
         #end
  	  <td class="$rowstyle" nowrap width="100%">
  	    <div align="center"><a href='$action'>$user</a></div>
  	  </td>
     </tr>
    #end
  </table>
  
  <hr/>
  
  <!-- controls -->
  <table width="200" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
      #if ($prev)
        <td valign="middle" height="30">
          <div align="center">
            <form action="$renderResponse.createActionURL()" method="post">
            	<input type='hidden' name='db.browser.action' value='first' />                    
              <input class="portlet-form-button" type="submit" value="<<">
              <input type="hidden" name="start" value="0">
            </form>
          </div>
        </td>  
        <td valign="middle" height="30">
          <div align="center">
            <form action="$renderResponse.createActionURL()" method="post">
            	<input type='hidden' name='db.browser.action' value='prev'/>                    
              <input class="portlet-form-button" type="submit" value="<">
              <input type="hidden" name="start" value="$prev">
            </form>
          </div>
        </td>
      #end
      #if ($tableSize > 0)
        <form action="$renderResponse.createActionURL()" method="post">
        <td valign="middle" height="30">
          <div align="center">
            	<input type='hidden' name='db.browser.action' value='change'/>                    
              <input type="input" name='start' size='5' value="$start" class="portlet-form-field-label">
          </div>
        </td>  
        <td valign="middle" height="30">
          <div align="center">
              <input type="input" readonly size='10' value="of $tableSize" class="portlet-form-field-label">            
          </div>
        </td>  
        <td valign="middle" height="30">
          <div align="center">
              <input class="portlet-form-button" type="submit" value="Go">            
          </div>
        </td>  
  
        </form>
  
        
      #end    
      #if ($next)
        <td valign="middle">
          <div align="center">
            <form action="$renderResponse.createActionURL()" method="post">
            	<input type='hidden' name='db.browser.action' value='next'/>          
              <input class="portlet-form-button" type="submit" value=">">
              <input type="hidden" name="start" value="$next">
            </form>
          </div>
        </td>
        <td valign="middle" height="30">
          <div align="center">
            <form action="$renderResponse.createActionURL()" method="post">
            	<input type='hidden' name='db.browser.action' value='last'/>                    
              <input class="portlet-form-button" type="submit" value=">>">
              <input type="hidden" name="start" value="$tableSize">
            </form>
          </div>
        </td>  
      #end
      #if ($tableSize > 0)
        <td valign="middle">
          <div align="center">
            <form action="$renderResponse.createActionURL()" method="post">
            	<input type='hidden' name='db.browser.action' value='refresh'/>
              <input class="portlet-form-button" type="submit" name="eventSubmit_doRefresh" value="Refresh" />
            </form>
          </div>
        </td>
      #end
    </tr>
  </table>
  <form action="$renderResponse.createActionURL()" method="post">
    	<input type='hidden' name='db.browser.action' value='search'/>                    
    	<input type='hidden' name='searchColumn' value='1'/>                      	
      <input class="portlet-form-button" type="submit" value="Search">
  	<input type="text" name="searchString" size="30" value="" class="portlet-form-field-label">    
  </form>
  
  
  

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