Project

General

Profile

Revision 1445

Added by Jing Tao over 18 years ago

Add access control for return fields in the subtree.

View differences:

src/edu/ucsb/nceas/metacat/DBQuery.java
419 419
            doclist.append((String)keylist.nextElement());
420 420
            doclist.append("',");
421 421
          }
422
          if (doclist.length() > 0) {
422
          if (doclist.length() > 0) 
423
          {
424
            Hashtable controlPairs = new Hashtable();
425
            double extendedQueryStart = System.currentTimeMillis()/1000;
423 426
            doclist.deleteCharAt(doclist.length()-1); //remove the last comma
424
            //pstmt.close();
425
            double extendedQueryStart = System.currentTimeMillis()/1000;
427
            // check if user has permission to see the return field data
428
            String accessControlSQL = qspec.
429
                        printAccessControlSQLForReturnField(doclist.toString());
430
            pstmt = dbconn.prepareStatement(accessControlSQL);
431
            //increase dbconnection usage count
432
            dbconn.increaseUsageCount(1);
433
            pstmt.execute();
434
            rs = pstmt.getResultSet();
435
            tableHasRows = rs.next();
436
            while(tableHasRows)
437
            {
438
              long startNodeId = rs.getLong(1);
439
              long endNodeId = rs.getLong(2);
440
              controlPairs.put(new Long(startNodeId), new Long(endNodeId));
441
            }
442
            
443
            double extendedAccessQueryEnd = System.currentTimeMillis()/1000;
444
            MetaCatUtil.debugMessage("Time for execute access extended query: "
445
                              +(extendedAccessQueryEnd-extendedQueryStart), 30);
446
            
426 447
            String extendedQuery = qspec.printExtendedSQL(doclist.toString());
427 448
            MetaCatUtil.debugMessage("Extended query: "+ extendedQuery, 30);
428 449
            pstmt = dbconn.prepareStatement(extendedQuery);

Also available in: Unified diff