Enhanced version to start implemented content moderation feature

This commit is contained in:
Luca Frosini 2021-05-10 16:16:18 +02:00
parent 6fad1ba8d1
commit 7051a5b952
3 changed files with 17 additions and 17 deletions

View File

@ -2,8 +2,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for gCube Catalogue (gCat) Service
## [v2.1.0-SNAPSHOT]
-
## [v2.0.0]
- Fixed retrieving of filename from content-disposition http header used to persist a resource [#21216]
- Fixed author and maintainer name and email [#21059] [#21189]
- Improved check on controlled vocabulary to match corner cases [#20742]
- Added PATCH method on Item collection [#19768]

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.data-catalogue</groupId>
<artifactId>gcat</artifactId>
<packaging>war</packaging>
<version>2.0.0</version>
<version>2.1.0-SNAPSHOT</version>
<name>gCube Catalogue (gCat) Service</name>
<description>
This service allows any client to publish on the gCube Catalogue.

View File

@ -118,8 +118,10 @@ public class CKANPackage extends CKAN {
protected String itemID;
protected ScopeBean currentScopeBean;
protected String currentContext;
protected final ScopeBean currentScopeBean;
protected final String currentContext;
protected final CKANUser ckanUser;
protected String currentOrganizationName;
protected Set<String> supportedOrganizations;
@ -134,13 +136,17 @@ public class CKANPackage extends CKAN {
DELETE = ITEM_DELETE;
PURGE = ITEM_PURGE;
managedResources = new ArrayList<CKANResource>();
getCurrentContext();
currentContext = ContextUtility.getCurrentContext();
currentScopeBean = new ScopeBean(currentContext);
ckanUser = CKANUserCache.getCurrrentCKANUser();
getSupportedOrganizationsFromIS();
}
protected Set<String> getSupportedOrganizationsFromIS() {
if(supportedOrganizations == null) {
// TODO Add a VRE based cache
supportedOrganizations = new HashSet<>();
SimpleQuery query = ICFactory.queryFor(GenericResource.class);
@ -172,12 +178,11 @@ public class CKANPackage extends CKAN {
}
CKANUser ckanUser = CKANUserCache.getCurrrentCKANUser();
for(String supportedOrganization : supportedOrganizations) {
ckanUser.addUserToOrganization(supportedOrganization);
}
logger.debug("Supported CKAN Organization for current Context ({}) are {}", getCurrentContext(),
logger.debug("Supported CKAN Organization for current Context ({}) are {}", currentContext,
supportedOrganizations);
return supportedOrganizations;
}
@ -190,14 +195,6 @@ public class CKANPackage extends CKAN {
return contextName.toLowerCase().replace(" ", "_");
}
protected String getCurrentContext() {
if(currentContext == null) {
currentContext = ContextUtility.getCurrentContext();
currentScopeBean = new ScopeBean(currentContext);
}
return currentContext;
}
protected String getOrganizationName() {
if(currentOrganizationName == null) {
this.currentOrganizationName = CKANPackage.getOrganizationName(currentScopeBean);
@ -308,9 +305,6 @@ public class CKANPackage extends CKAN {
objectNode.remove(CAPACITY_KEY);
}
CKANUser ckanUser = CKANUserCache.getCurrrentCKANUser();
String authorName = ckanUser.getPortalUser().getFullName();
if(authorName==null || authorName.compareTo("")==0) {
authorName = ckanUser.getName();