Ignoring non d4s roles when removing from user

This commit is contained in:
Mauro Mugnaini 2021-01-27 17:04:45 +01:00
parent 84531d5f8e
commit 14fbdd6fcf
1 changed files with 4 additions and 1 deletions
src/main/java/org/gcube/portal/oidc/lr62

View File

@ -159,7 +159,10 @@ public class UserSitesToGroupsAndRolesMapper {
log.info("Checking actual roles in the site's group");
for (String gcRoleName : actualSiteGroupRoles) {
String actualSiteName = actualSite.getName();
if (!actualSite.getRoles().contains(gcRoleName)) {
// 'D4ScienceMappings.Role.valueOf(gcRoleName) != null' is used to be sure that is a d4s role and not
// a Liferay role that must be let as it is
if (D4ScienceMappings.Role.valueOf(gcRoleName) != null
&& !actualSite.getRoles().contains(gcRoleName)) {
try {
log.info("Removing '" + gcRoleName + "' user's role for site: " + actualSiteName);
roleManager.removeRoleFromUser(user.getUserId(), actualSiteGroupId,