Changeset 38302 for main/trunk/greenstone3/src
- Timestamp:
- 2023-10-11T17:55:40+13:00 (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/SystemAction.java
r34018 r38302 25 25 26 26 String tempVal = ""; 27 27 protected static final String SYSTEM_ACTION = "SystemAction"; 28 28 29 /** process a request */ 29 30 public Node process(Node message_node) … … 52 53 else if(subaction.equals("authenticated-ping")) { 53 54 to = "RemoteAuthentication"; // not "Authentication/RemoteAuthentication": MessageRouter knows to map the RemoteAuthentication service to the Authentication module 55 } else if(subaction.equals("get-groups-from-session")) { 56 String msg = ""; 57 58 String suppliedUsername = (String) params.get(GSParams.UN); 59 if(!suppliedUsername.equals(userContext.getUsername())) { 60 msg = "Authentication failed: incorrect username for current session."; 61 } else { 62 String groups = userContext.getGroupsString(); 63 String suppliedCollection = params.containsKey("col") ? suppliedCollection = (String) params.get("col") : ""; 64 65 if(suppliedCollection.equals("")) { 66 msg = groups; 67 } else { 68 69 if(groups.indexOf("all-collections-editor") != -1) { // Does this user have access to all collections? 70 msg = groups; 71 } else if(groups.indexOf("personal-collections-editor") != -1 && suppliedCollection.startsWith(suppliedUsername+"-")) { // Does this user have access to personal collections, and is this one? 72 msg = groups; 73 } else if(groups.indexOf(suppliedCollection+"-collection-editor") != -1) { // Does this user have access to this collection? 74 msg = groups; 75 } 76 else { 77 msg = "Authentication failed: user is not in the required group."; 78 //logger.error("*** Remote login failed. Groups did not match for the collection specified"); 79 } 80 } 81 } 82 83 Element response = doc.createElement(GSXML.RESPONSE_ELEM); 84 response.setAttribute(GSXML.FROM_ATT, SYSTEM_ACTION); 85 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 86 Element s = GSXML.createTextElement(doc, GSXML.STATUS_ELEM, msg); 87 response.appendChild(s); 88 89 addSiteMetadata(response, userContext); 90 addInterfaceOptions(response); 91 92 result.appendChild(response); 93 return result; // done, no need to call a service 54 94 } 55 95 56 96 Element mr_request_message = doc.createElement(GSXML.MESSAGE_ELEM); 57 97 Element mr_request = GSXML.createBasicRequest(doc, GSXML.REQUEST_TYPE_SYSTEM, to, userContext);
Note:
See TracChangeset
for help on using the changeset viewer.