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:
parent
321512e876
commit
f4f0940381
|
@ -121,28 +121,31 @@ public class LiferayGroupManager implements GroupManager {
|
||||||
public VirtualGroup getVirtualGroup(long actualGroupId) throws GroupRetrievalFault, VirtualGroupNotExistingException {
|
public VirtualGroup getVirtualGroup(long actualGroupId) throws GroupRetrievalFault, VirtualGroupNotExistingException {
|
||||||
VirtualGroup toReturn = new VirtualGroup();
|
VirtualGroup toReturn = new VirtualGroup();
|
||||||
try {
|
try {
|
||||||
_log.debug("Setting Thread Permission");
|
|
||||||
long userId = LiferayUserManager.getAdmin().getUserId();
|
long userId = LiferayUserManager.getAdmin().getUserId();
|
||||||
PrincipalThreadLocal.setName(userId);
|
PrincipalThreadLocal.setName(userId);
|
||||||
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(UserLocalServiceUtil.getUser(userId));
|
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(UserLocalServiceUtil.getUser(userId));
|
||||||
PermissionThreadLocal.setPermissionChecker(permissionChecker);
|
PermissionThreadLocal.setPermissionChecker(permissionChecker);
|
||||||
Group site = GroupLocalServiceUtil.getGroup(actualGroupId);
|
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("")) {
|
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());
|
String warningMessage = String.format("Attribute %s not initialized.", CustomAttributeKeys.VIRTUAL_GROUP.getKeyName());
|
||||||
_log.warn(warningMessage);
|
_log.warn(warningMessage);
|
||||||
throw new VirtualGroupNotExistingException(warningMessage);
|
throw new VirtualGroupNotExistingException(warningMessage);
|
||||||
} else {
|
} else {
|
||||||
String[] values = (String[]) site.getExpandoBridge().getAttribute(CustomAttributeKeys.VIRTUAL_GROUP.getKeyName());
|
String[] values = (String[]) site.getExpandoBridge().getAttribute(CustomAttributeKeys.VIRTUAL_GROUP.getKeyName());
|
||||||
if (values != null) {
|
if (values != null && values.length > 0) {
|
||||||
String[] splits = values[0].split("\\|");
|
String[] splits = values[0].split("\\|");
|
||||||
toReturn.setName(splits[0]);
|
toReturn.setName(splits[0]);
|
||||||
toReturn.setDescription(splits[1]);
|
toReturn.setDescription(splits[1]);
|
||||||
|
} else {
|
||||||
|
toReturn.setName("NoVirtualGroupAssigned");
|
||||||
|
toReturn.setDescription("NoVirtualGroupDescription");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return toReturn;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
|
Loading…
Reference in New Issue