Used sysadmin to approve/reject the item

migrating_to_smartgears_4
Luca Frosini 2 years ago
parent 8395cebf3c
commit 1ccec24890

@ -1342,6 +1342,10 @@ public class CKANPackage extends CKAN implements Moderated {
throw new MethodNotSupportedException("Only catalogue moderator can approve a pending item.");
}
setToApproved(result);
// Need to use sysadmin because the user could not have the right to modify the item
setApiKey(CKANUtility.getSysAdminAPI());
String ret = sendPostRequest(ITEM_UPDATE, getAsString(result));
result = mapper.readTree(ret);
@ -1389,6 +1393,10 @@ public class CKANPackage extends CKAN implements Moderated {
}
setToRejected(result);
// Need to use sysadmin because the user could not have the right to modify the item
setApiKey(CKANUtility.getSysAdminAPI());
String ret = sendPostRequest(ITEM_PATCH, getAsString(result));
result = mapper.readTree(ret);
parseResult();
@ -1457,7 +1465,7 @@ public class CKANPackage extends CKAN implements Moderated {
throw new BadRequestException("Allowed moderation operations are approve, reject and message");
}
}else {
if(message==null || message.compareTo("")==0) {
if(message==null || message.length()==0) {
throw new BadRequestException("Allowed moderation operations are approve, reject and message");
}
message(message);

Loading…
Cancel
Save