Package com.wilfredmorgan.api.handlers
Class HelpFunctions
- java.lang.Object
-
- com.wilfredmorgan.api.handlers.HelpFunctions
-
@Component public class HelpFunctions extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description HelpFunctions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<ValidationError>getConstraintViolation(java.lang.Throwable cause)Searches to see if the exception has any constraint violations to reportbooleanisAuthorizedToMakeChange(java.lang.String username)Checks to see if the authenticated user has access to modify the requested user's information
-
-
-
Method Detail
-
isAuthorizedToMakeChange
public boolean isAuthorizedToMakeChange(java.lang.String username)
Checks to see if the authenticated user has access to modify the requested user's information- Parameters:
username- The user name of the user whose data is requested to be changed. This should either match the authenticated user or the authenticate must have the role ADMIN- Returns:
- true if the user can make the modifications, otherwise an exception is thrown
-
getConstraintViolation
public java.util.List<ValidationError> getConstraintViolation(java.lang.Throwable cause)
Searches to see if the exception has any constraint violations to report- Parameters:
cause- the exception to search- Returns:
- constraint violations formatted for sending to the client
-
-