added logs at INFO advising Notificatiom are disabled for the user

This commit is contained in:
Massimiliano Assante 2022-09-16 14:33:54 +02:00
parent 18b2fd231d
commit 7879cb795f
1 changed files with 16 additions and 4 deletions

View File

@ -75,6 +75,7 @@ import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault; import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException; import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
import org.gcube.vomanagement.usermanagement.model.GCubeUser; import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.mortbay.log.Log;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
@ -145,8 +146,8 @@ public class Notifications {
return Response.status(status).entity(responseBean).build(); return Response.status(status).entity(responseBean).build();
} }
/** /**
* @pathExample /is-user-disabled?username=john.smith * @pathExample /is-user-disabled?username=john.smith
* @responseExample application/json { "success": true, "message": null "result": true } * @responseExample application/json { "success": true, "message": null "result": true }
@ -184,7 +185,7 @@ public class Notifications {
return Response.status(status).entity(responseBean).build(); return Response.status(status).entity(responseBean).build();
} }
/** /**
* Set user notification enabled or disabled * Set user notification enabled or disabled
* @param disable true if you want to disable the notifications for this user, false if you want to enable them * @param disable true if you want to disable the notifications for this user, false if you want to enable them
@ -233,7 +234,7 @@ public class Notifications {
return Response.status(status).entity(responseBean).build(); return Response.status(status).entity(responseBean).build();
} }
/** /**
* *
* @param usernameToCheck * @param usernameToCheck
@ -387,6 +388,9 @@ public class Notifications {
event.getNotifyText(), event.getNotifyText(),
event.getItemURL()); event.getItemURL());
} }
else {
Log.info("Notification disabled (admin) for user "+userIdToNotify + " will not notify");
}
} }
} else { //the ids are contexts } else { //the ids are contexts
@ -412,6 +416,8 @@ public class Notifications {
event.getItemId(), event.getItemId(),
event.getNotifyText(), event.getNotifyText(),
event.getItemURL()); event.getItemURL());
} else {
Log.info("Notification disabled (admin) for user "+userIdToNotify + " will not notify");
} }
} }
} }
@ -497,6 +503,9 @@ public class Notifications {
} }
deliveryResult = notifyWorkspaceEvent(event, nm, username2Notify); deliveryResult = notifyWorkspaceEvent(event, nm, username2Notify);
} }
else {
Log.info("Notification disabled (admin) for user "+userIdToNotify + " will not notify");
}
} }
} else { //the ids are contexts } else { //the ids are contexts
for (int i = 0; i < idsToNotify.length; i++) { for (int i = 0; i < idsToNotify.length; i++) {
@ -515,6 +524,9 @@ public class Notifications {
String userIdToNotify = userIdsToNotify[j]; String userIdToNotify = userIdsToNotify[j];
if (isNotificationEnabled(userIdToNotify)) if (isNotificationEnabled(userIdToNotify))
deliveryResult = notifyWorkspaceEvent(event, nm, userIdToNotify); deliveryResult = notifyWorkspaceEvent(event, nm, userIdToNotify);
else {
Log.info("Notification disabled (admin) for user "+userIdToNotify + " will not notify");
}
} }
} }
} }