Project

General

Profile

« Previous | Next » 

Revision 859

Added by berkley over 22 years ago

fixed access control bug. the character data in the sax parser was not getting trimmed and causing problems. also fixed hard coded eml-dataset public id in the web index file

View differences:

lib/index.html
28 28
<html>
29 29
<head>
30 30
<title>KNB Data Search</title>
31
<meta HTTP-EQUIV="refresh" CONTENT="1;URL=@servlet-path@?action=query&operator=INTERSECT&anyfield=%25&qformat=knb&returndoctype=-//NCEAS//eml-dataset-2.0//EN&returnfield=title&returnfield=keyword&returnfield=originator/individualName/surName&returnfield=originator/organizationName" />
31
<meta HTTP-EQUIV="refresh" CONTENT="1;URL=@servlet-path@?action=query&operator=INTERSECT&anyfield=%25&qformat=knb&returndoctype=-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN&returnfield=title&returnfield=keyword&returnfield=originator/individualName/surName&returnfield=originator/organizationName" />
32 32
</head>
33 33
<body bgcolor="WHITE">
34 34
</body>
src/edu/ucsb/nceas/metacat/AccessControlList.java
89 89
  private int    serverCode = 1;
90 90

  
91 91
  private Vector aclObjects = new Vector();
92
  
92
  private boolean instarttag = true;
93
  private String tagName = "";
93 94
  /**
94 95
   * Construct an instance of the AccessControlList class.
95 96
   * It is used by the permission check up from DBQuery or DocumentImpl
......
224 225
                            String qName, Attributes atts) 
225 226
         throws SAXException 
226 227
  {
228
    instarttag = true;
229
    if(localName.equals("allow"))
230
    {
231
      tagName = "allow";
232
    }
233
    else if(localName.equals("deny"))
234
    {
235
      tagName = "deny";
236
    }
227 237
    BasicNode currentNode = new BasicNode(localName);
228 238
    if (atts != null) {
229 239
      int len = atts.getLength();
......
242 252
   * Callback method used by the SAX Parser when the text sequences of an 
243 253
   * xml stream are detected. Used in this context to parse and store
244 254
   * the acl information in class variables.
245
   */
255
   */ 
246 256
  public void characters(char ch[], int start, int length)
247 257
         throws SAXException 
248 258
  {
259
    if(!instarttag)
260
    {
261
      return;
262
    }
249 263
    String inputString = new String(ch, start, length);
264
    inputString = inputString.trim(); 
250 265
    BasicNode currentNode = (BasicNode)elementStack.peek(); 
251 266
    String currentTag = currentNode.getTagName();
252 267

  
......
262 277
          permission = permission | WRITE;
263 278
        } else if ( inputString.trim().toUpperCase().equals("ALL") ) {
264 279
          permission = permission | ALL;
265
        } else {
280
        } /*else{
266 281
          throw new SAXException("Unknown permission type: " + inputString);
267
        }
282
        }*/
268 283

  
269 284
      } else if ( currentTag.equals("startDate") && beginTime == null ) {
270 285
        beginTime = inputString.trim();
......
289 304
  public void endElement (String uri, String localName, String qName)
290 305
         throws SAXException 
291 306
  {
307
    instarttag = false;
292 308
    BasicNode leaving = (BasicNode)elementStack.pop();
293 309
    String leavingTagName = leaving.getTagName();
294 310

  

Also available in: Unified diff