Esri Geoportal Server
1.2.9

com.esri.gpt.server.identity
Class ManageUserServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.esri.gpt.framework.context.BaseServlet
              extended by com.esri.gpt.server.identity.ManageUserServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class ManageUserServlet
extends BaseServlet

Manage User servlet. Provides user role management functionality.

See Also:
Serialized Form

Constructor Summary
ManageUserServlet()
          Creates instance of the servlet.
 
Method Summary
protected  Roles buildSelectableRoles(RequestContext context)
          Builds a collection of configured roles in Geoportal (gpt.xml).
protected  HashMap<String,Object> buildUsersList(RequestContext context, String filter, String attributeName)
          Builds list of ldap users matching filter.
protected  boolean checkHasManageUsers(RequestContext context)
          Checks if manage user role is enabled
protected  boolean checkIfAllowConfigured(RequestContext context)
          Checks if manage user role is restricted to configured geoportal roles.
protected  boolean checkIfAllowedToManage(RequestContext context, String groupIdentifier)
          Checks if group is allowed to manage.
protected  boolean checkIfConfigured(RequestContext context, String groupIdentifier)
          Checks if group is configured.
protected  void checkRole(RequestContext context)
          Constructs a administrator based upon the user associated with the current request context.
protected  boolean checkRole(User user, String groupDn)
          Checks if user role matches provided groups distinguished name.
protected  boolean checkSelf(RequestContext context, String managedUserDn)
          Checks if managed user is active user.
protected  void execute(HttpServletRequest request, HttpServletResponse response, RequestContext context)
          Process the HTTP request.
protected  void executeAddMember(HttpServletRequest request, HttpServletResponse response, RequestContext context)
          Executes a add member action.
protected  void executeReadUser(HttpServletRequest request, HttpServletResponse response, RequestContext context)
          Reads user information from ldap.
protected  void executeRemoveMember(HttpServletRequest request, HttpServletResponse response, RequestContext context)
          Executes a remove member action.
protected  void executeSearch(HttpServletRequest request, HttpServletResponse response, RequestContext context)
          Searches users matching filter in ldap.
protected  void executeSearchMembers(HttpServletRequest request, HttpServletResponse response, RequestContext context)
          Searches users matching filter in ldap.
protected  User readUserProfile(RequestContext context, HttpServletRequest request)
          Reads user profile from ldap.
protected  String serializeUserAsJson(RequestContext context, User user)
          Serializes user information from ldap to json string.
protected  String serializeUsersAsJson(RequestContext context, String filter, String attributeName, boolean isMemberSearch)
          Serializes list of ldap users matching filter.
 
Methods inherited from class com.esri.gpt.framework.context.BaseServlet
authenticate, doGet, doPost, getCredentials, getLogger, getParameterValue, getRealm, readInputCharacters, writeCharacterResponse, writeHtmlResponse, writeXmlResponse
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManageUserServlet

public ManageUserServlet()
Creates instance of the servlet.

Method Detail

execute

protected void execute(HttpServletRequest request,
                       HttpServletResponse response,
                       RequestContext context)
                throws Exception
Process the HTTP request.

Specified by:
execute in class BaseServlet
Parameters:
request - HTTP request.
response - HTTP response.
context - request context
Throws:
ServletException - if error invoking command.
IOException - if error writing to the buffer.
Exception - if an exception occurs

executeSearchMembers

protected void executeSearchMembers(HttpServletRequest request,
                                    HttpServletResponse response,
                                    RequestContext context)
                             throws IdentityException,
                                    IOException,
                                    NamingException,
                                    SQLException
Searches users matching filter in ldap.

Parameters:
request - HTTP request.
response - HTTP response.
context - request context
Throws:
IdentityException - if a system error occurs preventing the action
IOException - if error writing to the buffer
NamingException - if an LDAP naming exception occurs
SQLException

executeSearch

protected void executeSearch(HttpServletRequest request,
                             HttpServletResponse response,
                             RequestContext context)
                      throws IdentityException,
                             IOException,
                             NamingException,
                             SQLException
Searches users matching filter in ldap.

Parameters:
request - HTTP request.
response - HTTP response.
context - request context
Throws:
IdentityException - if a system error occurs preventing the action
IOException - if error writing to the buffer
NamingException - if an LDAP naming exception occurs
SQLException

executeReadUser

protected void executeReadUser(HttpServletRequest request,
                               HttpServletResponse response,
                               RequestContext context)
                        throws Exception
Reads user information from ldap.

Parameters:
request - HTTP request.
response - HTTP response.
context - request context
Throws:
IOException - if error writing to the buffer
IdentityException - if a system error occurs preventing the action
NamingException - if an LDAP naming exception occurs
SQLException - if a database communication exception occurs
Exception

serializeUserAsJson

protected String serializeUserAsJson(RequestContext context,
                                     User user)
                              throws IdentityException,
                                     NamingException
Serializes user information from ldap to json string.

Parameters:
context - request context
user - the user to be serialized
Returns:
the user profile information serialized as json string.
Throws:
IdentityException - if a system error occurs preventing the action
NamingException - if an LDAP naming exception occurs

executeAddMember

protected void executeAddMember(HttpServletRequest request,
                                HttpServletResponse response,
                                RequestContext context)
                         throws Exception
Executes a add member action.

Parameters:
request - HTTP request.
response - HTTP response.
context - request context
Throws:
Exception - if an exception occurs

executeRemoveMember

protected void executeRemoveMember(HttpServletRequest request,
                                   HttpServletResponse response,
                                   RequestContext context)
                            throws Exception
Executes a remove member action.

Parameters:
request - HTTP request.
response - HTTP response.
context - request context
Throws:
Exception - if an exception occurs

checkIfConfigured

protected boolean checkIfConfigured(RequestContext context,
                                    String groupIdentifier)
Checks if group is configured.

Parameters:
context -
groupIdentifier -
Returns:
true if group is configured in geoportal

checkIfAllowedToManage

protected boolean checkIfAllowedToManage(RequestContext context,
                                         String groupIdentifier)
Checks if group is allowed to manage.

Parameters:
context -
groupIdentifier -
Returns:
true if group is allowed to manage in geoportal

checkSelf

protected boolean checkSelf(RequestContext context,
                            String managedUserDn)
Checks if managed user is active user.

Parameters:
context -
managedUserDn -
Returns:
true if managed user is same as active user

checkRole

protected boolean checkRole(User user,
                            String groupDn)
Checks if user role matches provided groups distinguished name.

Parameters:
user - user
groupDn - group distingushed name
Returns:
true if managed user role is same as groupDn

serializeUsersAsJson

protected String serializeUsersAsJson(RequestContext context,
                                      String filter,
                                      String attributeName,
                                      boolean isMemberSearch)
                               throws IdentityException,
                                      NamingException,
                                      SQLException
Serializes list of ldap users matching filter.

Parameters:
context - the current request context
filter - the user search filter for ldap
Returns:
the list of users as json
Throws:
IdentityException - if a system error occurs preventing the action
NamingException - if an LDAP naming exception occurs
SQLException

checkHasManageUsers

protected boolean checkHasManageUsers(RequestContext context)
Checks if manage user role is enabled

Parameters:
context - the current request context
Returns:
true is the functionality is enabled

checkIfAllowConfigured

protected boolean checkIfAllowConfigured(RequestContext context)
Checks if manage user role is restricted to configured geoportal roles.

Parameters:
context - the current request context
Returns:
true is the functionality is enabled

checkRole

protected void checkRole(RequestContext context)
                  throws NotAuthorizedException
Constructs a administrator based upon the user associated with the current request context.

Parameters:
context - the current request context (contains the active user)
Throws:
NotAuthorizedException - if the user does not have publishing rights

buildSelectableRoles

protected Roles buildSelectableRoles(RequestContext context)
Builds a collection of configured roles in Geoportal (gpt.xml).

Parameters:
context - the current request context (contains the active user)
Returns:
the collection of roles

buildUsersList

protected HashMap<String,Object> buildUsersList(RequestContext context,
                                                String filter,
                                                String attributeName)
                                         throws IdentityException,
                                                NamingException
Builds list of ldap users matching filter.

Parameters:
context - the current request context (contains the active user)
filter - the user search filter for ldap
Returns:
the list of users matching filter
Throws:
IdentityException - if a system error occurs preventing the action
NamingException - if an LDAP naming exception occurs

readUserProfile

protected User readUserProfile(RequestContext context,
                               HttpServletRequest request)
                        throws Exception
Reads user profile from ldap.

Parameters:
context - the current request context (contains the active user)
request - HTTP request.
Returns:
user the user whose profile was read
Throws:
IdentityException - if a system error occurs preventing the action
NamingException - if an LDAP naming exception occurs
SQLException - if a database communication exception occurs
CredentialsDeniedException
UnsupportedEncodingException
Exception

Esri Geoportal Server
1.2.9

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.