added fix while adding record to group

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@152486 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-08-04 12:41:04 +00:00
parent 0c8e25c2e1
commit 7da90e6aa6
2 changed files with 14 additions and 11 deletions

View File

@ -373,7 +373,7 @@ public class GrsfPublisherStockService {
@Path("update-product")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response updateFishery(
public Response updateStock(
@NotNull(message="record cannot be null")
@Valid StockRecord record,
@PathParam("source") String source)

View File

@ -69,17 +69,20 @@ public class AssociationToGroupThread extends Thread {
role = RolesCkanGroupOrOrg.MEMBER; // decrease the role to member if it is not an admin
for (String groupTitle : uniqueGroups) {
try{
logger.debug("Setting role " + role + " into group " + groupTitle + " to user " + username);
boolean assigned = catalogue.checkRoleIntoGroup(username, groupTitle, role);
logger.debug("Setting role " + role + " into group " + groupTitle + " to user " + username);
boolean assigned = catalogue.checkRoleIntoGroup(username, groupTitle, role);
if(!assigned){
logger.warn("The user " + username + " has not enough privileges to associate the dataset into group OR the group " + groupTitle + " doesn't exist ");
continue;
}
else{
boolean putIntoGroup = catalogue.assignDatasetToGroup(groupTitle, datasetId, apiKey);
logger.info("Was product put into group " + groupTitle + "? " + putIntoGroup);
if(!assigned){
logger.warn("The user " + username + " has not enough privileges to associate the dataset into group OR the group " + groupTitle + " doesn't exist ");
continue;
}
else{
boolean putIntoGroup = catalogue.assignDatasetToGroup(groupTitle, datasetId, apiKey);
logger.info("Was product put into group " + groupTitle + "? " + putIntoGroup);
}
}catch(Exception e){
logger.error("Something failed while adding product to group " + groupTitle, e);
}
}
logger.info("The Association Group thread ended correctly");