Project

General

Profile

« Previous | Next » 

Revision 7665

adjust action=zip behavior to use full docids when checking for permissions/existence. https://projects.ecoinformatics.org/ecoinfo/issues/3816

View differences:

src/edu/ucsb/nceas/metacat/DBQuery.java
2179 2179
        //for every docid in vector
2180 2180
        for (int i = 0; i < docIdList.size(); i++) {
2181 2181
            try {
2182
                //get newest version for this docId
2183
                rev = getCurrentRevFromXMLDoumentsTable((String) docIdList
2184
                        .elementAt(i));
2182
				//get newest version for this docId
2183
                String smartDocid = DocumentUtil.getSmartDocId((String) docIdList.elementAt(i));
2184
                rev = getCurrentRevFromXMLDoumentsTable(smartDocid);
2185 2185

  
2186 2186
                // There is no record for this docId in xml_documents table
2187 2187
                if (rev == -5) {
......
2193 2193
                    continue;
2194 2194
                }
2195 2195

  
2196
                String docidPlusVersion = ((String) docIdList.elementAt(i))
2196
                String docidPlusVersion = smartDocid
2197 2197
                        + PropertyService.getProperty("document.accNumSeparator") + rev;
2198 2198

  
2199 2199
                //create new documentImpl object
......
2453 2453
            return zOut;
2454 2454
        }
2455 2455
        // Check the permission of user
2456
        else if (!hasPermissionToExportPackage(docId, user, groups)) {
2456
        else if (!hasPermissionToExportPackage(docIdString, user, groups)) {
2457 2457

  
2458 2458
            Exception e = new Exception("User " + user
2459 2459
                    + " does not have permission"
......
2550 2550
                    docImpls = (DocumentImpl) documentImplList.elementAt(i);
2551 2551
                    //checking if the user has the permission to read the
2552 2552
                    // documents
2553
                    if (DocumentImpl.hasReadPermission(user, groups, docImpls
2554
                            .getDocID())) {
2553
                    
2554
                    String fullDocId = docImpls.getDocID() + PropertyService.getProperty("document.accNumSeparator") + docImpls.getRev();
2555
					if (DocumentImpl.hasReadPermission(user, groups, fullDocId )) {
2555 2556
                        //if the docImpls is metadata
2556 2557
                        if ((docImpls.getDoctype()).compareTo("BIN") != 0) {
2557 2558
                            //add metadata into zip output stream

Also available in: Unified diff