Commit 68bfac71 authored by Matija Obreza's avatar Matija Obreza

Merge branch 'unpublish-dataset-in-review' into 'master'

Fix: Allow returning datasets and descriptorLists from InReview to Draft state

See merge request genesys-pgr/genesys-server!477
parents 2c03e184 7367dc64
......@@ -922,7 +922,7 @@ public class DatasetServiceImpl implements DatasetService {
throw new NotFoundElement("No dataset with specified uuid and version");
}
if (!securityUtils.hasRole(UserRole.ADMINISTRATOR)) {
if (loaded.isPublished() && !securityUtils.hasRole(UserRole.ADMINISTRATOR)) {
long oneDay = 24 * 60 * 60 * 1000;
if (loaded.getLastModifiedDate() != null && loaded.getLastModifiedDate().getTime() <= (System.currentTimeMillis() - oneDay)) {
throw new InvalidApiUsageException("Cannot be un-published. More than 24 hours have passed since the publication.");
......
......@@ -478,7 +478,7 @@ public class DescriptorListServiceImpl implements DescriptorListService {
throw new NotFoundElement("No DescriptorList with specified uuid and version");
}
if (!securityUtils.hasRole(UserRole.ADMINISTRATOR)) {
if (loaded.isPublished() && !securityUtils.hasRole(UserRole.ADMINISTRATOR)) {
long oneDay = 24 * 60 * 60 * 1000;
if (loaded.getLastModifiedDate() != null && loaded.getLastModifiedDate().getTime() <= (System.currentTimeMillis() - oneDay)) {
throw new InvalidApiUsageException("Cannot be un-published. More than 24 hours have passed since the publication.");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment