From f4f0940381f9bdd783b8276c9e09c98984591aa9 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Fri, 18 Mar 2016 13:29:18 +0000 Subject: [PATCH] moved vgroup managment in usersmanagement library git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vo-management/usermanagement-core@125716 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../usermanagement/impl/LiferayGroupManager.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 0857897..b77d6ca 100644 --- a/src/main/java/org/gcube/vomanagement/usermanagement/impl/LiferayGroupManager.java +++ b/src/main/java/org/gcube/vomanagement/usermanagement/impl/LiferayGroupManager.java @@ -121,28 +121,31 @@ public class LiferayGroupManager implements GroupManager { public VirtualGroup getVirtualGroup(long actualGroupId) throws GroupRetrievalFault, VirtualGroupNotExistingException { VirtualGroup toReturn = new VirtualGroup(); try { - _log.debug("Setting Thread Permission"); long userId = LiferayUserManager.getAdmin().getUserId(); PrincipalThreadLocal.setName(userId); PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(UserLocalServiceUtil.getUser(userId)); PermissionThreadLocal.setPermissionChecker(permissionChecker); Group site = GroupLocalServiceUtil.getGroup(actualGroupId); + _log.debug("Set Thread Permission done, getVirtual Group of " + site.getName()); if (site.getExpandoBridge().getAttribute(CustomAttributeKeys.VIRTUAL_GROUP.getKeyName()) == null || site.getExpandoBridge().getAttribute(CustomAttributeKeys.VIRTUAL_GROUP.getKeyName()).equals("")) { String warningMessage = String.format("Attribute %s not initialized.", CustomAttributeKeys.VIRTUAL_GROUP.getKeyName()); _log.warn(warningMessage); throw new VirtualGroupNotExistingException(warningMessage); } else { String[] values = (String[]) site.getExpandoBridge().getAttribute(CustomAttributeKeys.VIRTUAL_GROUP.getKeyName()); - if (values != null) { + if (values != null && values.length > 0) { String[] splits = values[0].split("\\|"); toReturn.setName(splits[0]); toReturn.setDescription(splits[1]); + } else { + toReturn.setName("NoVirtualGroupAssigned"); + toReturn.setDescription("NoVirtualGroupDescription"); } } } catch (Exception e) { e.printStackTrace(); } - return null; + return toReturn; } /** * {@inheritDoc}