Interface AdminUserContextValidator<P extends AdminUser>
- All Known Implementing Classes:
DefaultAdminUserContextValidator
public interface AdminUserContextValidator<P extends AdminUser>
Various validation functions for use when performing CRUD operations related to an admin user. If
the
ContextInfo
argument or tenant/application ids are null on the context, certain
validation should still be performed (e.g. ensuring email/username are available).- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isMutableByCurrentUser
(P user) Returns whether or not the given entity is mutable by the current authenticated user.boolean
isMutableFromContext
(P user, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns whether or not the given entity is mutable from the given context.void
validateContextForModification
(P user, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validate that modification of a user is valid in the current context.org.springframework.validation.Errors
validateCreate
(P user, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a create operation is allowed in the current context.void
validateCreate
(P user, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a create operation is allowed in the current context.void
validateCurrentUserForModification
(P user, org.springframework.validation.Errors errors) Validate that modification of a user is permitted for the current authenticated user.org.springframework.validation.Errors
validateDelete
(P user, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a delete operation is allowed in the current context.void
validateDelete
(P user, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a create operation is allowed in the current context.org.springframework.validation.Errors
validateUpdate
(P user, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates an update operation is allowed in the current context.void
validateUpdate
(P user, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a create operation is allowed in the current context.
-
Method Details
-
validateCreate
org.springframework.validation.Errors validateCreate(P user, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a create operation is allowed in the current context.- Parameters:
user
- The user to validatecontextInfo
- The current context- Returns:
- An
Errors
object bound to a {code user} - See Also:
-
validateUpdate
org.springframework.validation.Errors validateUpdate(P user, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates an update operation is allowed in the current context.- Parameters:
user
- The user to validatecontextInfo
- The current context- Returns:
- An
Errors
object bound to a {code user} - See Also:
-
validateDelete
org.springframework.validation.Errors validateDelete(P user, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a delete operation is allowed in the current context.- Parameters:
user
- The user to validatecontextInfo
- The current context- Returns:
- An
Errors
object bound to a {code user} - See Also:
-
validateCreate
void validateCreate(P user, org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a create operation is allowed in the current context.- Parameters:
user
- The user to validateerrors
- An errors object bound to theuser
to be validatedcontextInfo
- The current context
-
validateUpdate
void validateUpdate(P user, org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a create operation is allowed in the current context.- Parameters:
user
- The user to validateerrors
- An errors object bound to theuser
to be validatedcontextInfo
- The current context
-
validateDelete
void validateDelete(P user, org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a create operation is allowed in the current context.- Parameters:
user
- The user to validateerrors
- An errors object bound to theuser
to be validatedcontextInfo
- The current context
-
validateContextForModification
void validateContextForModification(P user, org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validate that modification of a user is valid in the current context. The default implementation immediately aborts by throwing a runtime exception, though custom implementations may use theerrors
object if desired.- Parameters:
user
- The user to validate againsterrors
- An errors object bound to theuser
to be validatedcontextInfo
- The current context- See Also:
-
isMutableFromContext
boolean isMutableFromContext(P user, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns whether or not the given entity is mutable from the given context.- Parameters:
user
- the entity whose mutability should be checkedcontextInfo
- the context in which mutability should be checked- Returns:
- true if the entity is mutable from the given context, false otherwise
-
validateCurrentUserForModification
Validate that modification of a user is permitted for the current authenticated user. The default implementation immediately aborts by throwing a runtime exception, though custom implementations may use theerrors
object if desired.- Parameters:
user
- The user to validate againsterrors
- An errors object bound to theuser
to be validated
-
isMutableByCurrentUser
Returns whether or not the given entity is mutable by the current authenticated user.- Parameters:
user
- the entity whose mutability should be checked- Returns:
- true if the entity is mutable by the current user, false otherwise
-