Project

General

Profile

Revision 7368

when performing query, make sure we are using the access rules of the latest revision of a given docid, otherwise we may include documents that used to be public but have been made private in subsequent revisions.
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5696

View differences:

src/edu/ucsb/nceas/metacat/QuerySpecification.java
274 274
        String allowString = constructAllowString();
275 275
        allowQuery = "SELECT id.docid from xml_access xa, identifier id WHERE id.guid = xa.guid AND ( " + allowString;
276 276
        allowQuery = allowQuery + ")";
277
        allowQuery = allowQuery + " AND id.rev = (select max(rev) from identifier maxid WHERE maxid.docid = id.docid)";
277 278
        logMetacat.info("QuerySpecification.createAllowRuleQuery - allow query is: " + allowQuery);
278 279
        return allowQuery;
279 280

  
......
321 322
        String denyString = constructDenyString();
322 323
        denyQuery = "SELECT id.docid from xml_access xa, identifier id WHERE id.guid = xa.guid AND ( " + denyString;
323 324
        denyQuery = denyQuery + ") ";
325
        denyQuery = denyQuery + " AND id.rev = (select max(rev) from identifier maxid WHERE maxid.docid = id.docid)";
324 326
        logMetacat.info("QuerySpecification.createDenyRuleQuery - denyquery is: " + denyQuery);
325 327
        return denyQuery;
326 328

  

Also available in: Unified diff