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
This commit is contained in:
Massimiliano Assante 2016-03-18 13:29:18 +00:00
parent 321512e876
commit f4f0940381
1 changed files with 6 additions and 3 deletions

View File

@ -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}