From f2c69764d0fd0ac2c7dac12115044c9f5e985cc6 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Fri, 14 Oct 2016 16:24:36 +0000 Subject: [PATCH] When assigning a role to a user in a group, if he is Admin of the org he will be also an admin of the group, otherwise he will be a member git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@133217 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../server/AssociationToGroupThread.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/AssociationToGroupThread.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/AssociationToGroupThread.java index 0e21b51..4b15689 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/AssociationToGroupThread.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/AssociationToGroupThread.java @@ -51,10 +51,13 @@ public class AssociationToGroupThread extends Thread { }else{ logger.debug("Group exists, going to add the user " + username + " as its admin..."); - + // retrieve the role to be assigned according the one the user has into the organization of the dataset RolesCkanGroupOrOrg role = RolesCkanGroupOrOrg.valueOf(catalogue.getRoleOfUserInOrganization(username, organization, catalogue.getApiKeyFromUsername(username)).toUpperCase()); + if(!role.equals(RolesCkanGroupOrOrg.ADMIN)) + role = RolesCkanGroupOrOrg.MEMBER; // decrease the role to member if it is not an admin + boolean assigned = catalogue.checkRoleIntoGroup(username, groupTitle, role); if(assigned){