Use extracted new convenience method for Role existance check by string

This commit is contained in:
Mauro Mugnaini 2021-01-27 19:36:42 +01:00
parent 874d91537b
commit db8887e3b1
1 changed files with 2 additions and 3 deletions

View File

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