From 49d7eef9561c39b6568a503cd76b3e6971a92089 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Tue, 23 Feb 2016 13:31:09 +0000 Subject: [PATCH] git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vo-management/usermanagement-core@124492 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../usermanagement/GroupManager.java | 21 ++++++++++++-- .../impl/LiferayGroupManager.java | 28 +++++++++++++++++++ .../usermanagement/model/GCubeUser.java | 11 +++++++- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/gcube/vomanagement/usermanagement/GroupManager.java b/src/main/java/org/gcube/vomanagement/usermanagement/GroupManager.java index 6a8e130..af47c03 100644 --- a/src/main/java/org/gcube/vomanagement/usermanagement/GroupManager.java +++ b/src/main/java/org/gcube/vomanagement/usermanagement/GroupManager.java @@ -55,6 +55,23 @@ public interface GroupManager { * @throws GroupRetrievalFault */ String getRootVOName() throws UserManagementSystemException, GroupRetrievalFault; + /** + * + * @param groupId the LR groupId + * @return the infrastructure scope given the groupId e.g. for devsec VO would return /gcube/devsec + * @throws UserManagementSystemException + * @throws GroupRetrievalFault + */ + String getInfrastructureScope(long groupId) throws UserManagementSystemException, GroupRetrievalFault; + /** + * @deprecated + * please use getInfrastructureScope(long groupId) + * @param groupId the LR groupId + * @return the infrastructure scope given the groupId e.g. for devsec VO would return /gcube/devsec + * @throws UserManagementSystemException + * @throws GroupRetrievalFault + */ + String getScope(long groupId) throws UserManagementSystemException, GroupRetrievalFault; /** * * @return a flat list of VOs and VREs present in this gateway mapped as @see {@link GCubeGroup} * @throws UserManagementSystemException @@ -62,7 +79,7 @@ public interface GroupManager { */ List listGroups() throws UserManagementSystemException, GroupRetrievalFault ; /** - * @param userId + * @param userId the LR userId * @return a flat list of VOs and VREs where the user is registered as @see {@link GCubeGroup} * @throws UserRetrievalFault * @throws UserManagementSystemException @@ -71,7 +88,7 @@ public interface GroupManager { List listGroupsByUser(long userId) throws UserRetrievalFault, UserManagementSystemException, GroupRetrievalFault; /** * - * @param userId + * @param userId the LR userId * @return a map contaiting the users groups and his roles in the group * @throws UserManagementSystemException */ diff --git a/src/main/java/org/gcube/vomanagement/usermanagement/impl/LiferayGroupManager.java b/src/main/java/org/gcube/vomanagement/usermanagement/impl/LiferayGroupManager.java index 4b5361f..12a75e0 100644 --- a/src/main/java/org/gcube/vomanagement/usermanagement/impl/LiferayGroupManager.java +++ b/src/main/java/org/gcube/vomanagement/usermanagement/impl/LiferayGroupManager.java @@ -238,5 +238,33 @@ public class LiferayGroupManager implements GroupManager { } return false; } + /** + * {@inheritDoc} + */ + @Override + public String getInfrastructureScope(long groupId) throws UserManagementSystemException, GroupRetrievalFault { + try { + Group g = GroupLocalServiceUtil.getGroup(groupId); + if (isVRE(groupId)) + return "/" + g.getParentGroup().getName() + "/" + g.getParentGroup().getName() + "/" + g.getName(); + if (isVO(groupId)) + return "/" + g.getParentGroup().getName() + "/" + g.getName(); + if (isRootVO(groupId)) + return "/"+g.getName(); + + } catch (PortalException e1) { + throw new GroupRetrievalFault("Group not existing (I think you better check)", e1); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + /** + * {@inheritDoc} + */ + @Override + public String getScope(long groupId) throws UserManagementSystemException, GroupRetrievalFault { + return getInfrastructureScope(groupId); + } } diff --git a/src/main/java/org/gcube/vomanagement/usermanagement/model/GCubeUser.java b/src/main/java/org/gcube/vomanagement/usermanagement/model/GCubeUser.java index 694137c..8540aac 100644 --- a/src/main/java/org/gcube/vomanagement/usermanagement/model/GCubeUser.java +++ b/src/main/java/org/gcube/vomanagement/usermanagement/model/GCubeUser.java @@ -107,10 +107,19 @@ public class GCubeUser implements Serializable { public String getUsername() { return username; } - + public void setUsername(String username) { this.username = username; } + /** + * @deprecated + * please use getUsername + * @return the username + */ + public String getScreenName() { + return username; + } + public String getEmail() { return email;