diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 4e4a3ad..43c8195 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,9 +1,11 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/WsThreddsWidget.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/WsThreddsWidget.java index 177da75..697a2d0 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/WsThreddsWidget.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/WsThreddsWidget.java @@ -183,8 +183,8 @@ public class WsThreddsWidget implements HasWsSyncNotificationListner { if(result!=null) { GWT.log("Returned Map(Scope,Role): "+result); - final boolean isThreddsPubliser = result.containsValue(GatewayRolesThredds.THREDDS_PUBLISHER); - final boolean isThreddsAdmin = result.containsValue(GatewayRolesThredds.THREDDS_ADMIN); + final boolean isThreddsPubliser = result.containsValue(GatewayRolesThredds.DATA_EDITOR); + final boolean isThreddsAdmin = result.containsValue(GatewayRolesThredds.DATA_MANAGER); //no rights assigned if(!isThreddsAdmin && !isThreddsPubliser) { diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncService.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncService.java index 28a7b99..4c20452 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncService.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncService.java @@ -61,7 +61,7 @@ public interface ThreddsWorkspaceSyncService extends RemoteService { * @return the list of vr es for logged user * @throws Exception the exception */ - List getListOfScopesForLoggedUser() throws Exception; + List getListOfDataManagerScopesForLoggedUser() throws Exception; /** * Gets the available catalogues for scope. diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncServiceAsync.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncServiceAsync.java index aff801c..0372091 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncServiceAsync.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/rpc/ThreddsWorkspaceSyncServiceAsync.java @@ -92,7 +92,7 @@ public interface ThreddsWorkspaceSyncServiceAsync * @param callback the callback * @return the list of scopes for logged user */ - void getListOfScopesForLoggedUser(AsyncCallback> callback); + void getListOfDataManagerScopesForLoggedUser(AsyncCallback> callback); /** * Gets the available catalogues for scope. diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.java index dccda16..e38dc46 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.java @@ -187,7 +187,7 @@ public abstract class CreateThreddsConfigurationView extends Composite { }); - WsThreddsWidget.wsThreddsSyncService.getListOfScopesForLoggedUser(new AsyncCallback>() { + WsThreddsWidget.wsThreddsSyncService.getListOfDataManagerScopesForLoggedUser(new AsyncCallback>() { @Override public void onSuccess(List result) { diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/ShowThreddsFolderInfoView.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/ShowThreddsFolderInfoView.java index 4762035..7f61589 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/ShowThreddsFolderInfoView.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/ShowThreddsFolderInfoView.java @@ -179,7 +179,7 @@ public abstract class ShowThreddsFolderInfoView extends Composite { }); if(isCreateConfiguration) { - WsThreddsWidget.wsThreddsSyncService.getListOfScopesForLoggedUser(new AsyncCallback>() { + WsThreddsWidget.wsThreddsSyncService.getListOfDataManagerScopesForLoggedUser(new AsyncCallback>() { @Override public void onSuccess(List result) { diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/ThreddsWorkspaceSyncServiceImpl.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/ThreddsWorkspaceSyncServiceImpl.java index 9cd73f9..027a9b8 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/ThreddsWorkspaceSyncServiceImpl.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/ThreddsWorkspaceSyncServiceImpl.java @@ -28,6 +28,7 @@ import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault; import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager; import org.gcube.vomanagement.usermanagement.model.GCubeGroup; import org.gcube.vomanagement.usermanagement.model.GCubeUser; +import org.gcube.vomanagement.usermanagement.model.GatewayRolesNames; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -155,9 +156,8 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem /** * Gets the list of Scopes (Root-VO, VOs and VREs) for user and the Thredds roles that user has in them. * - * @param user the user * @return the VREs and Thredds roles for a given user - * @throws Exception + * @throws Exception the exception */ @Override public Map getScopesWithThreddsRolesForLoggedUser() throws Exception{ @@ -190,14 +190,15 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem } + /** - * Gets the list of VR es for logged user. + * Gets the list scope with the role Data-Manager for logged user. * - * @return the list of VR es for logged user + * @return the list of manager scopes for logged user * @throws Exception the exception */ @Override - public List getListOfScopesForLoggedUser() throws Exception{ + public List getListOfDataManagerScopesForLoggedUser() throws Exception{ logger.info("getListOfVREsForLoggedUser...: "); GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest()); long userId = user.getUserId(); @@ -240,7 +241,7 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem if(scopeType!=null){ GatewayRolesThredds roles = WsUtil.getThreddsRoleFor(user, gCubeGroup); //Adding only the scope where the user has the THREDDS_ADMIN role - GcubeScope gcubeScope = availableScopeForRoleAndCatalogue(roles, gCubeGroup, groupManager, scopeType); + GcubeScope gcubeScope = checkDataManagerCapacityAndThreddsCatalogue(roles, gCubeGroup, groupManager, scopeType); if(gcubeScope!=null) { listOfScopes.add(gcubeScope); } @@ -250,7 +251,7 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem GCubeGroup theRootVO = groupManager.getRootVO(); GatewayRolesThredds roles = WsUtil.getThreddsRoleFor(user, theRootVO); ///ADDING THE ROOT SCOPE if the user has the THREDDS_ADMIN role in the ROOT-VO - GcubeScope gcubeScope = availableScopeForRoleAndCatalogue(roles, theRootVO, groupManager, GcubeScopeType.ROOT); + GcubeScope gcubeScope = checkDataManagerCapacityAndThreddsCatalogue(roles, theRootVO, groupManager, GcubeScopeType.ROOT); if(gcubeScope!=null) { listOfScopes.add(gcubeScope); } @@ -269,19 +270,19 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem } if(listOfScopes.isEmpty()) { - throw new Exception("No scope detected with the needed role: "+GatewayRolesThredds.THREDDS_ADMIN.getRoleName()+". Contact the VRE manager or the portal administrator"); + throw new Exception("No scope detected with the needed role: "+GatewayRolesThredds.DATA_MANAGER.getRoleName()+". Contact the VRE manager or the portal administrator"); } Collections.sort(listOfScopes); - logger.info("Returning list of allowed scope/s with: "+GatewayRolesThredds.THREDDS_ADMIN + " role/s: "+listOfScopes); + logger.info("Returning list of allowed scope/s with: "+GatewayRolesThredds.DATA_MANAGER + " role/s: "+listOfScopes); return listOfScopes; } /** - * Available scope for role and catalogue, checks if for the input scope: + * Checks if for the input scope: * - the user has the role {@link GatewayRolesThredds.#THREDDS_ADMIN} - * - the scope has an available thredds catalogue configured + * - the scope has an available THREDDS catalogue configured * * @param role the role * @param scope the scope @@ -290,9 +291,9 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem * @return the gcube scope {@link GcubeScope} if the two conditions (see description) are satisfied, null otherwise * @throws Exception the exception */ - private GcubeScope availableScopeForRoleAndCatalogue(GatewayRolesThredds role, GCubeGroup scope, GroupManager groupManager, GcubeScopeType scopeType) throws Exception { + private GcubeScope checkDataManagerCapacityAndThreddsCatalogue(GatewayRolesThredds role, GCubeGroup scope, GroupManager groupManager, GcubeScopeType scopeType) throws Exception { - if(role!=null && role.equals(GatewayRolesThredds.THREDDS_ADMIN)) { + if(role!=null && role.getRoleName().equalsIgnoreCase(GatewayRolesNames.DATA_MANAGER.getRoleName())){ try { List list = getAvailableCataloguesForScope(scope.getGroupName()); if(list!=null) { @@ -318,7 +319,7 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem */ private GcubeScope availableScopeForRole(GatewayRolesThredds role, GCubeGroup scope, GroupManager groupManager, GcubeScopeType scopeType) throws Exception { - if(role!=null && role.equals(GatewayRolesThredds.THREDDS_ADMIN)) { + if(role!=null && role.equals(GatewayRolesThredds.DATA_MANAGER)) { return new GcubeScope(scope.getGroupName(), groupManager.getInfrastructureScope(scope.getGroupId()), scopeType); } return null; diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/WsUtil.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/WsUtil.java index ee9ef4a..f9ee38e 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/WsUtil.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/WsUtil.java @@ -160,21 +160,21 @@ public class WsUtil { List roles = roleManager.listRolesByUserAndGroup(user.getUserId(), scope.getGroupId()); List threddsRoles = new ArrayList(); for (GCubeRole gCubeRole : roles) { - if(gCubeRole.getRoleName().equalsIgnoreCase(GatewayRolesThredds.THREDDS_ADMIN.getRoleName())){ - threddsRoles.add(GatewayRolesThredds.THREDDS_ADMIN); + if(gCubeRole.getRoleName().equalsIgnoreCase(GatewayRolesThredds.DATA_MANAGER.getRoleName())){ + threddsRoles.add(GatewayRolesThredds.DATA_MANAGER); } - if(gCubeRole.getRoleName().equalsIgnoreCase(GatewayRolesThredds.THREDDS_PUBLISHER.getRoleName())){ - threddsRoles.add(GatewayRolesThredds.THREDDS_PUBLISHER); + if(gCubeRole.getRoleName().equalsIgnoreCase(GatewayRolesThredds.DATA_EDITOR.getRoleName())){ + threddsRoles.add(GatewayRolesThredds.DATA_EDITOR); } } logger.info("For user: "+user+" in the scope: "+scope.getGroupName()+" read the role/s: " + threddsRoles); GatewayRolesThredds toReturn = null; - if (threddsRoles.contains(GatewayRolesThredds.THREDDS_ADMIN)) - toReturn = GatewayRolesThredds.THREDDS_ADMIN; - else if (threddsRoles.contains(GatewayRolesThredds.THREDDS_PUBLISHER)) - toReturn = GatewayRolesThredds.THREDDS_PUBLISHER; + if (threddsRoles.contains(GatewayRolesThredds.DATA_MANAGER)) + toReturn = GatewayRolesThredds.DATA_MANAGER; + else if (threddsRoles.contains(GatewayRolesThredds.DATA_EDITOR)) + toReturn = GatewayRolesThredds.DATA_EDITOR; logger.info("returning role: " + toReturn); return toReturn; diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GatewayRolesThredds.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GatewayRolesThredds.java index 2fa7f1c..31f26c9 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GatewayRolesThredds.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/shared/GatewayRolesThredds.java @@ -2,8 +2,8 @@ package org.gcube.portlets.widgets.wsthreddssync.shared; public enum GatewayRolesThredds { - THREDDS_ADMIN("Thredds-Admin"), - THREDDS_PUBLISHER("Thredds-Publisher"); + DATA_MANAGER("Data-Manager"), + DATA_EDITOR("Data-Editor"); private String name;