Logs message changed from info to debug

This commit is contained in:
Mauro Mugnaini 2021-03-17 11:41:43 +01:00
parent 5580b20923
commit 2e84e960b8
1 changed files with 13 additions and 12 deletions

View File

@ -92,7 +92,7 @@ public class UserSitesToGroupsAndRolesMapper {
}
public void map() {
log.info("Mapping roles to sites for user: " + user.getScreenName());
log.debug("Mapping roles to sites for user: " + user.getScreenName());
Site gwSitesTree = null;
try {
gwSitesTree = mapper.map(rootVOName);
@ -127,10 +127,10 @@ public class UserSitesToGroupsAndRolesMapper {
}
try {
if (groupManager.isVRE(actualSiteGroupId) && !actualGroupAndRoles.containsKey(actualSiteGroupId)) {
log.info("Assigning user to new VRE site: " + actualSite.getName());
log.debug("Assigning user to new VRE site: " + actualSite.getName());
userManager.assignUserToGroup(actualSiteGroupId, user.getUserId());
if (actualSite.getRoles() != null && !actualSite.getRoles().isEmpty()) {
log.info("Assiging roles for the new assigned VRE site");
log.debug("Assiging roles for the new assigned VRE site");
for (String roleName : actualSite.getRoles()) {
if (D4ScienceMappings.Role.MEMBER.asString().equals(roleName)) {
// Member role is only to assure that the user belongs to context, covered by the assign
@ -142,7 +142,7 @@ public class UserSitesToGroupsAndRolesMapper {
// Since it's a VRE we can return
return;
} else {
log.info("User has no roles in the VRE site");
log.debug("User has no roles in the VRE site");
}
}
} catch (UserManagementSystemException | GroupRetrievalFault | UserRetrievalFault
@ -156,14 +156,14 @@ public class UserSitesToGroupsAndRolesMapper {
// Removing the Member role that is not a real role in LR
newRoles.remove(D4ScienceMappings.Role.MEMBER.asString());
if (actualSiteGroupRoles != null && !actualSiteGroupRoles.isEmpty()) {
log.info("Checking actual roles in the site's group");
log.debug("Checking actual roles in the site's group");
for (String gcRoleName : actualSiteGroupRoles) {
String actualSiteName = actualSite.getName();
// '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.exists(gcRoleName) && !actualSite.getRoles().contains(gcRoleName)) {
try {
log.info("Removing '" + gcRoleName + "' user's role for site: " + actualSiteName);
log.debug("Removing '" + gcRoleName + "' user's role for site: " + actualSiteName);
roleManager.removeRoleFromUser(user.getUserId(), actualSiteGroupId,
roleNameToRole.get(gcRoleName).getRoleId());
} catch (UserManagementSystemException | UserRetrievalFault | GroupRetrievalFault
@ -181,7 +181,7 @@ public class UserSitesToGroupsAndRolesMapper {
}
}
} else {
log.info("User actually has no roles different from Member in the site");
log.debug("User actually has no roles different from Member in the site");
}
if (!newRoles.isEmpty()) {
// Adding roles that remaining in newRoles list, if any, for the user in this site
@ -192,7 +192,7 @@ public class UserSitesToGroupsAndRolesMapper {
GCubeRole newGcRole = roleNameToRole.get(newRole);
if (newGcRole != null) {
try {
log.info("Assinging new role '" + newRole + "' to user");
log.debug("Assinging new role '" + newRole + "' to user");
roleManager.assignRoleToUser(user.getUserId(), actualSiteGroupId, newGcRole.getRoleId());
} catch (UserManagementSystemException | UserRetrievalFault | GroupRetrievalFault
| RoleRetrievalFault e) {
@ -210,11 +210,11 @@ public class UserSitesToGroupsAndRolesMapper {
}
}
} else {
log.info("Roles were not set, continuing descending letting them untouched in site: "
log.debug("Roles were not set, continuing descending letting them untouched in site: "
+ actualSite.getName());
}
for (Site childSite : actualSite.getChildren().values()) {
log.info("Recursive call to child site: " + childSite.getName());
log.debug("Recursive call to child site: " + childSite.getName());
rolesToSiteDescendant(childSite);
}
}
@ -231,14 +231,14 @@ public class UserSitesToGroupsAndRolesMapper {
}
}
} else {
log.info("User not belongs to any VRE");
log.debug("User not belongs to any VRE");
}
for (Long actualGroupId : actualGroupAndRoles.keySet()) {
try {
String actualGroupName = groupManager.getGroup(actualGroupId).getGroupName();
if (groupManager.isVRE(actualGroupId)) {
if (!vreNames.contains(actualGroupName)) {
log.info("Removing user from VRE: " + actualGroupName);
log.debug("Removing user from VRE: " + actualGroupName);
try {
userManager.dismissUserFromGroup(actualGroupId, user.getUserId());
} catch (UserRetrievalFault e) {
@ -259,3 +259,4 @@ public class UserSitesToGroupsAndRolesMapper {
}
}