From db8887e3b1fba12b95439d40cfdf7f10ff2f99ce Mon Sep 17 00:00:00 2001 From: Mauro Mugnaini Date: Wed, 27 Jan 2021 19:36:42 +0100 Subject: [PATCH] Use extracted new convenience method for Role existance check by string --- .../portal/oidc/lr62/UserSitesToGroupsAndRolesMapper.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/gcube/portal/oidc/lr62/UserSitesToGroupsAndRolesMapper.java b/src/main/java/org/gcube/portal/oidc/lr62/UserSitesToGroupsAndRolesMapper.java index 1f6625c..1a70fbe 100644 --- a/src/main/java/org/gcube/portal/oidc/lr62/UserSitesToGroupsAndRolesMapper.java +++ b/src/main/java/org/gcube/portal/oidc/lr62/UserSitesToGroupsAndRolesMapper.java @@ -159,10 +159,9 @@ public class UserSitesToGroupsAndRolesMapper { log.info("Checking actual roles in the site's group"); for (String gcRoleName : actualSiteGroupRoles) { String actualSiteName = actualSite.getName(); - // 'D4ScienceMappings.Role.valueOf(gcRoleName) != null' is used to be sure that is a d4s role and not + // 'D4ScienceMappings.Role.exists(gcRoleName)' 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)) { + if (D4ScienceMappings.Role.exists(gcRoleName) && !actualSite.getRoles().contains(gcRoleName)) { try { log.info("Removing '" + gcRoleName + "' user's role for site: " + actualSiteName); roleManager.removeRoleFromUser(user.getUserId(), actualSiteGroupId,