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 TypeMethodDescriptionbooleanisMutableByCurrentUser(P user) Returns whether or not the given entity is mutable by the current authenticated user.booleanisMutableFromContext(P user, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns whether or not the given entity is mutable from the given context.voidvalidateContextForModification(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.ErrorsvalidateCreate(P user, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a create operation is allowed in the current context.voidvalidateCreate(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.voidvalidateCurrentUserForModification(P user, org.springframework.validation.Errors errors) Validate that modification of a user is permitted for the current authenticated user.org.springframework.validation.ErrorsvalidateDelete(P user, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a delete operation is allowed in the current context.voidvalidateDelete(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.ErrorsvalidateUpdate(P user, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates an update operation is allowed in the current context.voidvalidateUpdate(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
Errorsobject 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
Errorsobject 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
Errorsobject 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 theuserto 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 theuserto 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 theuserto 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 theerrorsobject if desired.- Parameters:
user- The user to validate againsterrors- An errors object bound to theuserto 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 theerrorsobject if desired.- Parameters:
user- The user to validate againsterrors- An errors object bound to theuserto 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
-