Revision 1300
Added by Jing Tao over 22 years ago
src/edu/ucsb/nceas/metacat/DBQuery.java | ||
---|---|---|
219 | 219 |
int serialNumber = -1; |
220 | 220 |
|
221 | 221 |
try { |
222 |
/*if (conn == null || conn.isClosed()) { |
|
223 |
dbconn = util.openDBConnection(); |
|
224 |
} else { |
|
225 |
dbconn = conn; |
|
226 |
}*/ |
|
222 |
|
|
227 | 223 |
|
228 | 224 |
dbconn=DBConnectionPool.getDBConnection("DBQuery.findDocuments"); |
229 | 225 |
serialNumber=dbconn.getCheckOutSerialNumber(); |
230 |
// problem with ODBC driver multi-threading |
|
231 |
// dbconn2 = util.openDBConnection(); // for use by AccessControlList |
|
232 |
|
|
226 |
|
|
233 | 227 |
// Get the XML query and covert it into a SQL statment |
234 | 228 |
QuerySpecification qspec = new QuerySpecification(xmlquery, |
235 | 229 |
parserName, |
236 | 230 |
util.getOption("accNumSeparator")); |
231 |
// set user name and group |
|
232 |
qspec.setUserName(user); |
|
233 |
qspec.setGroup(groups); |
|
237 | 234 |
String query = qspec.printSQL(useXMLIndex); |
238 | 235 |
MetaCatUtil.debugMessage("query: "+query, 30); |
239 |
//System.out.println(qspec.printSQL(useXMLIndex)); |
|
236 |
// Get access query |
|
237 |
String accessQuery = qspec.getAccessQuery(); |
|
238 |
query = query + accessQuery; |
|
239 |
MetaCatUtil.debugMessage(" final query: "+query, 30); |
|
240 |
|
|
240 | 241 |
double startTime = System.currentTimeMillis()/1000; |
241 | 242 |
pstmt = dbconn.prepareStatement(query); |
242 | 243 |
|
... | ... | |
250 | 251 |
while (tableHasRows) |
251 | 252 |
{ |
252 | 253 |
docid = rs.getString(1).trim(); |
253 |
long checkTimeStart = System.currentTimeMillis(); |
|
254 |
boolean permit =hasPermission(user, groups, docid); |
|
255 |
long checkTimeEnd = System.currentTimeMillis(); |
|
256 |
MetaCatUtil.debugMessage("check permission time: "+ |
|
257 |
(checkTimeEnd - checkTimeStart), 30); |
|
258 |
if ( !permit ) { |
|
254 |
//long checkTimeStart = System.currentTimeMillis();
|
|
255 |
//boolean permit =hasPermission(user, groups, docid);
|
|
256 |
//long checkTimeEnd = System.currentTimeMillis();
|
|
257 |
//MetaCatUtil.debugMessage("check permission time: "+
|
|
258 |
//(checkTimeEnd - checkTimeStart), 30);
|
|
259 |
//if ( !permit ) {
|
|
259 | 260 |
// Advance to the next record in the cursor |
260 |
tableHasRows = rs.next(); |
|
261 |
continue; |
|
262 |
} |
|
261 |
//tableHasRows = rs.next();
|
|
262 |
//continue;
|
|
263 |
//}
|
|
263 | 264 |
|
264 | 265 |
docname = rs.getString(2); |
265 | 266 |
doctype = rs.getString(3); |
Also available in: Unified diff
Add the checking permission query into orignal query.