- Timestamp:
- 2012-02-21T16:26:17+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java
r25092 r25128 14 14 import javax.servlet.http.*; 15 15 16 import java.security.Principal;17 16 import java.util.Collection; 18 17 import java.util.Enumeration; … … 99 98 */ 100 99 protected Hashtable session_ids_table = new Hashtable(); 101 100 102 101 /** 103 102 * the maximum interval that the cached info remains in session_ids_table … … 722 721 request.login(username[0], password[0]); 723 722 } 724 725 if (request.getAuthType() != null)723 724 if (request.getAuthType() != null) 726 725 { 727 726 Element userInformation = this.doc.createElement("userInformation"); 728 727 xml_request.appendChild(userInformation); 729 728 userInformation.setAttribute("username", request.getUserPrincipal().getName()); 730 } 731 729 730 Element userInfoMessage = this.doc.createElement(GSXML.MESSAGE_ELEM); 731 Element userInfoRequest = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_SECURITY, "GetUserInformation", userContext); 732 userInfoMessage.appendChild(userInfoRequest); 733 734 Element paramList = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 735 userInfoRequest.appendChild(paramList); 736 737 Element param = this.doc.createElement(GSXML.PARAM_ELEM); 738 param.setAttribute(GSXML.NAME_ATT, "username"); 739 param.setAttribute(GSXML.VALUE_ATT, request.getUserPrincipal().getName()); 740 paramList.appendChild(param); 741 742 Element userInformationResponse = (Element) GSXML.getChildByTagName(this.recept.process(userInfoMessage), GSXML.RESPONSE_ELEM); 743 Element responseParamList = (Element) GSXML.getChildByTagName(userInformationResponse, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 744 if (responseParamList == null) 745 { 746 logger.error("Can't get the groups for user " + request.getUserPrincipal().getName()); 747 } 748 749 HashMap responseParams = GSXML.extractParams(responseParamList, true); 750 String groups = (String) responseParams.get("groups"); 751 752 userInformation.setAttribute("groups", groups); 753 } 732 754 733 755 //If we are in a collection-related page then make sure this user is allowed to access it … … 771 793 Element paramList = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 772 794 loginPageRequest.appendChild(paramList); 773 795 774 796 Element messageParam = this.doc.createElement(GSXML.PARAM_ELEM); 775 797 messageParam.setAttribute(GSXML.NAME_ATT, "loginMessage"); 776 if (request.getAuthType() == null)798 if (request.getAuthType() == null) 777 799 { 778 800 messageParam.setAttribute(GSXML.VALUE_ATT, "Please log in to view this page"); … … 780 802 else 781 803 { 782 messageParam.setAttribute(GSXML.VALUE_ATT, "You are not in the correct group to view this page ");804 messageParam.setAttribute(GSXML.VALUE_ATT, "You are not in the correct group to view this page, would you like to log in as a different user?"); 783 805 } 784 806 paramList.appendChild(messageParam); 785 807 786 808 Element urlParam = this.doc.createElement(GSXML.PARAM_ELEM); 787 809 urlParam.setAttribute(GSXML.NAME_ATT, "redirectURL");
Note:
See TracChangeset
for help on using the changeset viewer.