1381 |
1381 |
|
1382 |
1382 |
if (distributionType == DistributionSection.DATA_DISTRIBUTION) {
|
1383 |
1383 |
try {
|
1384 |
|
// check for the previous version for permissions
|
1385 |
|
int latestRevision = DBUtil.getLatestRevisionInDocumentTable(distributionSection.getDataFileName());
|
1386 |
|
String previousDocid =
|
1387 |
|
distributionSection.getDataFileName() + PropertyService.getProperty("document.accNumSeparator") + latestRevision;
|
|
1384 |
// check for the previous version for permissions on update
|
|
1385 |
String dataDocid = distributionSection.getDataFileName();
|
|
1386 |
String previousDocid = dataDocid;
|
|
1387 |
if (action == "UPDATE") {
|
|
1388 |
String docidWithoutRev = DocumentUtil.getDocIdFromString(dataDocid);
|
|
1389 |
int latestRevision = DBUtil.getLatestRevisionInDocumentTable(docidWithoutRev);
|
|
1390 |
if (latestRevision > 0) {
|
|
1391 |
previousDocid = distributionSection.getDataFileName() + PropertyService.getProperty("document.accNumSeparator") + latestRevision;
|
|
1392 |
}
|
|
1393 |
}
|
|
1394 |
|
1388 |
1395 |
PermissionController controller = new PermissionController(previousDocid);
|
1389 |
1396 |
|
1390 |
1397 |
if (AccessionNumber.accNumberUsed(docid)
|
... | ... | |
1807 |
1814 |
currentDistributionSection.setDataFileName(guid);
|
1808 |
1815 |
|
1809 |
1816 |
// distributionOnlineFileName = docid;
|
1810 |
|
onlineDataFileIdInRelationVector.add(docid);
|
|
1817 |
onlineDataFileIdInRelationVector.add(guid);
|
1811 |
1818 |
try {
|
1812 |
1819 |
if (!AccessionNumber.accNumberUsed(docid)) {
|
1813 |
|
onlineDataFileIdInTopAccessVector.add(docid);
|
|
1820 |
onlineDataFileIdInTopAccessVector.add(guid);
|
1814 |
1821 |
} else {
|
1815 |
|
PermissionController controller = new PermissionController(accessionNumber);
|
|
1822 |
// check the previous revision if we have it
|
|
1823 |
int previousRevision = rev;
|
|
1824 |
Vector<Integer> revisions = DBUtil.getRevListFromRevisionTable(docid);
|
|
1825 |
if (revisions != null && revisions.size() > 0) {
|
|
1826 |
previousRevision = revisions.get(revisions.size() - 1);
|
|
1827 |
}
|
|
1828 |
String previousDocid =
|
|
1829 |
docid + PropertyService.getProperty("document.accNumSeparator") + previousRevision;
|
|
1830 |
|
|
1831 |
PermissionController controller = new PermissionController(previousDocid);
|
1816 |
1832 |
if (controller.hasPermission(user, groups,AccessControlInterface.ALLSTRING)) {
|
1817 |
|
onlineDataFileIdInTopAccessVector.add(docid);
|
|
1833 |
onlineDataFileIdInTopAccessVector.add(guid);
|
1818 |
1834 |
} else {
|
1819 |
1835 |
throw new SAXException(UPDATEACCESSERROR);
|
1820 |
1836 |
}
|
check previous revision for permissions to update (includes data described by EML)