Changeset 25309
- Timestamp:
- 2012-03-28T16:52:24+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/URLFilter.java
r25306 r25309 22 22 import org.w3c.dom.Document; 23 23 import org.w3c.dom.Element; 24 import org.w3c.dom.NodeList; 24 25 25 26 public class URLFilter implements Filter … … 134 135 135 136 Element metaResponse = (Element) gsRouter.process(metaMessage); 136 //GSXML.printXMLNode(metaResponse, true); 137 GSXML.printXMLNode(metaResponse, true); 138 139 NodeList metadataList = metaResponse.getElementsByTagName(GSXML.METADATA_ELEM); 140 if(metadataList.getLength() == 0) 141 { 142 _logger.error("Could not find the document related to this url"); 143 } 144 else 145 { 146 Element metadata = (Element)metadataList.item(0); 147 String document = metadata.getTextContent(); 148 149 //Get the security info for this collection 150 Element securityMessage = gsDoc.createElement(GSXML.MESSAGE_ELEM); 151 Element securityRequest = GSXML.createBasicRequest(gsDoc, GSXML.REQUEST_TYPE_SECURITY, collection, new UserContext()); 152 securityMessage.appendChild(securityRequest); 153 if (document != null && !document.equals("")) 154 { 155 securityRequest.setAttribute(GSXML.NODE_OID, document); 156 } 157 158 Element securityResponse = (Element) GSXML.getChildByTagName(gsRouter.process(securityMessage), GSXML.RESPONSE_ELEM); 159 ArrayList<String> groups = GSXML.getGroupsFromSecurityResponse(securityResponse); 160 161 if (!groups.contains("")) 162 { 163 boolean found = false; 164 for (String group : groups) 165 { 166 if (((HttpServletRequest)request).isUserInRole(group)) 167 { 168 found = true; 169 break; 170 } 171 } 172 173 if(!found) 174 { 175 return; 176 } 177 } 178 } 137 179 } 138 180 else
Note:
See TracChangeset
for help on using the changeset viewer.