Removed Home Library dependency
integated support to send events to the Orchestrator service
This commit is contained in:
parent
a15c354f9b
commit
4665e7c14d
|
@ -0,0 +1,28 @@
|
|||
|
||||
# Changelog for VREFolder Liferay Hook
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
|
||||
## [v6.7.0] - 2020-11-17
|
||||
|
||||
Ported to git
|
||||
|
||||
Removed Home Library dependency, integrated support to send events to the Orchestrator service and Keycloak
|
||||
|
||||
## [v6.6.0] - 2018-03-02
|
||||
|
||||
Feature #6094 User export to LDAP on create account and join/leave VRE
|
||||
|
||||
## [v6.5.0] - 2017-05-23
|
||||
|
||||
Feature #8242 Enhance VRE Folder hook to also create Share LaTeX user on user add to VRE
|
||||
|
||||
## [v6.4.0] - 2017-02-23
|
||||
|
||||
Feature #6680, added hook to keep in sync VRE Managers and Workspace VRE Folder Managers
|
||||
|
||||
## [v6.3.0] - 2016-03-16
|
||||
|
||||
First release after switch to new liferay version (6.2.6)
|
|
@ -0,0 +1,26 @@
|
|||
# Acknowledgments
|
||||
|
||||
The projects leading to this software have received funding from a series of European Union programmes including:
|
||||
|
||||
- the Sixth Framework Programme for Research and Technological Development
|
||||
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
|
||||
- the Seventh Framework Programme for research, technological development and demonstration
|
||||
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
|
||||
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
|
||||
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
|
||||
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
|
||||
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
|
||||
- the H2020 research and innovation programme
|
||||
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
|
||||
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
|
||||
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
|
||||
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
|
||||
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
|
||||
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
|
||||
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
|
||||
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
|
||||
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
|
||||
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
|
||||
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
|
||||
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
|
||||
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);
|
|
@ -1,6 +1,6 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portal.plugins.VREFolder-hook.6-7-0" date="2019-10-10">
|
||||
<Change>Feature #17556, Modify liferay TomcatValve and Hook to set roles on Authorization</Change>
|
||||
<Change>Feature #17556, new role assigned event intercepted to set roles on the Legacy Authorization</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portal.plugins.VREFolder-hook.6-6-0" date="2018-03-02">
|
||||
<Change>Feature #6094 User export to LDAP on create account and join/leave VRE</Change>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
|||
<groupId>org.gcube.portal.plugins</groupId>
|
||||
<artifactId>VREFolder-hook</artifactId>
|
||||
<name>VREFolder-hook Hook</name>
|
||||
<version>6.7.0-SNAPSHOT</version>
|
||||
<version>6.7.0</version>
|
||||
<packaging>war</packaging>
|
||||
<description>
|
||||
VREFolder-hook handles the user adding/removal from the related Home Library VRE Folder
|
||||
|
|
|
@ -23,15 +23,12 @@ import org.gcube.vomanagement.usermanagement.model.GatewayRolesNames;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.liferay.portal.kernel.exception.PortalException;
|
||||
import com.liferay.portal.kernel.exception.SystemException;
|
||||
import com.liferay.portal.model.Role;
|
||||
import com.liferay.portal.model.User;
|
||||
import com.liferay.portal.model.UserGroupRole;
|
||||
import com.liferay.portal.service.RoleLocalServiceUtil;
|
||||
import com.liferay.portal.service.UserGroupRoleLocalService;
|
||||
import com.liferay.portal.service.UserGroupRoleLocalServiceWrapper;
|
||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||
|
||||
public class GCubeHookSiteRoleLocalService extends UserGroupRoleLocalServiceWrapper {
|
||||
/**
|
||||
|
@ -56,63 +53,49 @@ public class GCubeHookSiteRoleLocalService extends UserGroupRoleLocalServiceWrap
|
|||
return toReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.List<com.liferay.portal.model.UserGroupRole> addUserGroupRoles(long userId, long groupId,
|
||||
long[] roleIds) throws com.liferay.portal.kernel.exception.SystemException {
|
||||
List<UserGroupRole> toReturn = super.addUserGroupRoles(userId, groupId, roleIds);
|
||||
try {
|
||||
String context = gm.getInfrastructureScope(groupId);
|
||||
String username = UserLocalServiceUtil.getUser(userId).getScreenName();
|
||||
/* Check this part CAREFULLY as when the user is just created it fails*/
|
||||
String userToken = authorizationService().resolveTokenByUserAndContext(username, context);
|
||||
List<String> userRoles = getUserRoles(roleIds);
|
||||
authorizationService().setTokenRoles(userToken, userRoles);
|
||||
_log.debug("Check if addUserGroupRoles is done in a VRE");
|
||||
if (gm.isVRE(groupId)) {
|
||||
_log.debug("addUserGroupRoles performed in a VRE, groupId=" + groupId);
|
||||
boolean vreManagerRolePresent = false;
|
||||
for (int i = 0; i < roleIds.length; i++) {
|
||||
Role role = RoleLocalServiceUtil.getRole(roleIds[i]);
|
||||
if (role.getName().compareTo(GCubeRole.VRE_MANAGER_LABEL) == 0) {
|
||||
_log.info("User is being promoted (or was) as VREFolder Administrator, userId=" + userId
|
||||
+ " on Site groupId=" + groupId);
|
||||
vreManagerRolePresent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
setVREFolderAdministrator(userId, groupId, vreManagerRolePresent);
|
||||
} else {
|
||||
_log.debug("addUserGroupRoles NOT done in a VRE, groupId=" + groupId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
public java.util.List<com.liferay.portal.model.UserGroupRole> addUserGroupRoles(
|
||||
long userId, long groupId, long[] roleIds)
|
||||
throws com.liferay.portal.kernel.exception.SystemException {
|
||||
List<UserGroupRole> toReturn = super.addUserGroupRoles(userId, groupId, roleIds);
|
||||
try {
|
||||
_log.debug("Check if addUserGroupRoles is done in a VRE");
|
||||
if (gm.isVRE(groupId)) {
|
||||
_log.debug("addUserGroupRoles performed in a VRE, groupId=" + groupId);
|
||||
boolean vreManagerRolePresent = false;
|
||||
for (int i = 0; i < roleIds.length; i++) {
|
||||
Role role = RoleLocalServiceUtil.getRole(roleIds[i]);
|
||||
if (role.getName().compareTo(GCubeRole.VRE_MANAGER_LABEL) == 0) {
|
||||
_log.info("User is being promoted (or was) as VREFolder Administrator, userId=" + userId + " on Site groupId="+groupId);
|
||||
vreManagerRolePresent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
setVREFolderAdministrator(userId, groupId, vreManagerRolePresent);
|
||||
} else {
|
||||
_log.debug("addUserGroupRoles NOT done in a VRE, groupId=" + groupId);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private List<String> getUserRoles(long[] roleIds) throws PortalException, SystemException {
|
||||
List<String> toReturn = new ArrayList<>();
|
||||
for (int i = 0; i < roleIds.length; i++) {
|
||||
Role role = RoleLocalServiceUtil.getRole(roleIds[i]);
|
||||
toReturn.add(role.getName());
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private boolean setVREFolderAdministrator(long userId, long groupId, boolean enable) throws Exception {
|
||||
String context = gm.getInfrastructureScope(groupId);
|
||||
ScopeProvider.instance.set(context);
|
||||
String vreFolderTitle = Util.getVREGroupFromContext(context);
|
||||
_log.info("The vreFolderTitle on which the VREFolder role is being {} is {}", enable, vreFolderTitle);
|
||||
_log.info("Before StorageHubClient shc = new StorageHubClient();");
|
||||
_log.debug("Before StorageHubClient shc = new StorageHubClient();");
|
||||
StorageHubClient shc = new StorageHubClient();
|
||||
_log.info("Before shc.getVreFolderManager(vreFolderTitle);");
|
||||
_log.debug("Before shc.getVreFolderManager(vreFolderTitle);");
|
||||
VREFolderManager vreFolderManager = shc.getVreFolderManager(vreFolderTitle);
|
||||
|
||||
String previousToken = SecurityTokenProvider.instance.get();
|
||||
|
||||
//get the super user
|
||||
_log.info("//get the super user");
|
||||
_log.debug("//get the super user");
|
||||
|
||||
String infraContext = "/" + PortalContext.getConfiguration().getInfrastructureName();
|
||||
long rootgroupId = gm.getGroupIdFromInfrastructureScope(infraContext);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name=VREFolder-hook
|
||||
module-group-id=liferay
|
||||
module-incremental-version=6
|
||||
module-incremental-version=7
|
||||
tags=
|
||||
short-description=
|
||||
change-log=
|
||||
|
|
Loading…
Reference in New Issue