minor fix: the role the user will have into a group is the one he/she has into the organization in which the product is going to be published
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@132003 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c8df6dea6a
commit
6017ee35af
|
@ -19,6 +19,7 @@ public class AssociationToGroupThread extends Thread {
|
|||
private String datasetId;
|
||||
private String username;
|
||||
private DataCatalogue catalogue;
|
||||
private String organization;
|
||||
|
||||
/**
|
||||
* @param groupTitle
|
||||
|
@ -27,11 +28,12 @@ public class AssociationToGroupThread extends Thread {
|
|||
* @param catalogue
|
||||
*/
|
||||
public AssociationToGroupThread(String groupTitle, String datasetId,
|
||||
String username, DataCatalogue catalogue) {
|
||||
String username, DataCatalogue catalogue, String organization) {
|
||||
this.groupTitle = groupTitle;
|
||||
this.datasetId = datasetId;
|
||||
this.username = username;
|
||||
this.catalogue = catalogue;
|
||||
this.organization = organization;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +52,10 @@ public class AssociationToGroupThread extends Thread {
|
|||
|
||||
logger.debug("Group exists, going to add the user " + username + " as its admin...");
|
||||
|
||||
boolean assigned = catalogue.checkRoleIntoGroup(username, groupTitle, RolesCkanGroupOrOrg.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()));
|
||||
|
||||
boolean assigned = catalogue.checkRoleIntoGroup(username, groupTitle, role);
|
||||
|
||||
if(assigned){
|
||||
|
||||
|
|
|
@ -497,7 +497,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
// start a thread that will associate this dataset with the group
|
||||
if(toCreate.getChosenProfile() != null){
|
||||
|
||||
AssociationToGroupThread thread = new AssociationToGroupThread(toCreate.getChosenProfile(), datasetId, userName, utils);
|
||||
AssociationToGroupThread thread = new AssociationToGroupThread(toCreate.getChosenProfile(), datasetId, userName, utils, organizationNameOrId);
|
||||
thread.start();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue