changed params for set notifications

This commit is contained in:
Massimiliano Assante 2022-09-16 12:14:11 +02:00
parent 195d8f1f65
commit 4b50b72ff5
1 changed files with 13 additions and 7 deletions

View File

@ -143,22 +143,28 @@ public class Notifications {
return Response.status(status).entity(responseBean).build();
}
/**
* @pathExample /is-user-disabled?username=john.smith
* @responseExample application/json { "success": true, "message": null "result": true }
*/
@GET
@Path("is-user-disabled/")
@Produces(MediaType.APPLICATION_JSON)
/**
* Return whether the notifications for this user are enabled or not
* @param username the username you want to check
* @return true if the notification for the user are disabled (Catalogue and Workspace ones)
*
*/
@Produces(MediaType.APPLICATION_JSON)
@StatusCodes ({
@ResponseCode ( code = 200, condition = "Users with silenced notifications are reported in the 'result' field of the returned object"),
@ResponseCode ( code = 200, condition = "true if the notification for the username given as query param are disabled (Catalogue and Workspace ones), false otherwise"),
@ResponseCode ( code = 500, condition = ErrorMessages.ERROR_IN_API_RESULT)
})
@AuthorizationControl(allowedRoles={INFRASTRUCTURE_MANAGER_ROLE}, exception=AuthException.class)
public Response isUserDisabled(
@QueryParam("username") @NotNull(message="username cannot be null") @Size(min=2, message="username cannot be empty")
@QueryParam("username") @NotNull(message="username cannot be null")
String username) throws ValidationException{
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
@ -179,7 +185,7 @@ public class Notifications {
/**
* Set user notification enabled or disabled
* @param disable true if you want to disable the notifications for this user
* @param disable true if you want to disable the notifications for this user, false if you want to enable them
* @return the result of the operation
* @throws ValidationException
*/
@ -193,9 +199,9 @@ public class Notifications {
})
@AuthorizationControl(allowedRoles={INFRASTRUCTURE_MANAGER_ROLE}, exception=AuthException.class)
public Response setUserNotifications(
@QueryParam("username") @NotNull(message="username cannot be null") @Size(min=2, message="username cannot be empty")
@NotNull(message="username cannot be null")
String username,
@QueryParam("disable") @NotNull(message="must specify the disable parameter")
@NotNull(message="must specify the disable parameter")
boolean disable) throws ValidationException{
Caller caller = AuthorizationProvider.instance.get();