Class DefaultAccountMemberRestrictionChangeRequestHandler
java.lang.Object
com.broadleafcommerce.auth.user.service.DefaultAccountMemberRestrictionChangeRequestHandler
- All Implemented Interfaces:
AccountMemberRestrictionChangeRequestHandler
public class DefaultAccountMemberRestrictionChangeRequestHandler
extends Object
implements AccountMemberRestrictionChangeRequestHandler
Respond to
AccountMemberRestrictionUpdateEvent to update User Restrictions when an
Account Member's restrictions are updated.- Author:
- karanjariwala
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultAccountMemberRestrictionChangeRequestHandler(UserService<User> userService, UserResourceLockService<User> userResourceLockService) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanareRestrictedPermissionsEqual(@NonNull Set<RestrictedPermission> existingRestrictedPermissions, @NonNull Set<RestrictedPermission> newRestrictedPermissions) Checks if the existing and new restrictedPermission sets are equal.protected booleanareRestrictedRolesEqual(@NonNull Set<RestrictedRole> existingRestrictedRoles, @NonNull Set<RestrictedRole> newRestrictedRoles) Checks if the existing and new restrictedRole sets are equal.protected booleanareRestrictionsEqual(@NonNull Set<Restriction> existingRestrictions, @NonNull Set<Restriction> newRestrictions) Checks if the existing and new restriction sets are equal.protected UserResourceLockService<User>protected UserService<User>voidhandle(@NonNull AccountMemberRestrictionUpdateEvent event) Handles anAccountMemberRestrictionUpdateEventto update the restrictions if applicable.protected booleanmapUpdatesFromRequest(@NonNull User user, @NonNull AccountMemberRestrictionUpdateEvent event) Perform any necessary updates of the user.protected booleanupdateRestrictedPermissions(@NonNull User user, @NonNull AccountMemberRestrictionUpdateEvent event) Perform any necessary updates of the user restrictedPermissions.protected booleanupdateRestrictedRoles(@NonNull User user, @NonNull AccountMemberRestrictionUpdateEvent event) Perform any necessary updates of the user restrictedRoles.protected booleanupdateRestrictions(@NonNull User user, @NonNull AccountMemberRestrictionUpdateEvent event) Perform any necessary updates of the user restrictions.
-
Constructor Details
-
DefaultAccountMemberRestrictionChangeRequestHandler
public DefaultAccountMemberRestrictionChangeRequestHandler(UserService<User> userService, UserResourceLockService<User> userResourceLockService)
-
-
Method Details
-
handle
Description copied from interface:AccountMemberRestrictionChangeRequestHandlerHandles anAccountMemberRestrictionUpdateEventto update the restrictions if applicable.- Specified by:
handlein interfaceAccountMemberRestrictionChangeRequestHandler- Parameters:
event- the event containing updated restrictions
-
mapUpdatesFromRequest
protected boolean mapUpdatesFromRequest(@NonNull @NonNull User user, @NonNull @NonNull AccountMemberRestrictionUpdateEvent event) Perform any necessary updates of the user. If no update is necessary, this will return false. This event will only affect the restriction entities within the account context.- Parameters:
user- The existing userevent- The event that contains a potentially updated user withing account context- Returns:
- true if the user should be updated, else false
-
updateRestrictions
protected boolean updateRestrictions(@NonNull @NonNull User user, @NonNull @NonNull AccountMemberRestrictionUpdateEvent event) Perform any necessary updates of the user restrictions. If no update is necessary, this will return false.- Parameters:
user- The existing userevent- The event that contains a potentially updated user- Returns:
- true if the user should be updated, else false
-
areRestrictionsEqual
protected boolean areRestrictionsEqual(@NonNull @NonNull Set<Restriction> existingRestrictions, @NonNull @NonNull Set<Restriction> newRestrictions) Checks if the existing and new restriction sets are equal.- Parameters:
existingRestrictions- the existing user restrictionsnewRestrictions- the updated user restrictions- Returns:
- true if the sets are equal, otherwise false
-
updateRestrictedPermissions
protected boolean updateRestrictedPermissions(@NonNull @NonNull User user, @NonNull @NonNull AccountMemberRestrictionUpdateEvent event) Perform any necessary updates of the user restrictedPermissions. If no update is necessary, this will return false.- Parameters:
user- The existing userevent- The event that contains a potentially updated user- Returns:
- true if the user should be updated, else false
-
areRestrictedPermissionsEqual
protected boolean areRestrictedPermissionsEqual(@NonNull @NonNull Set<RestrictedPermission> existingRestrictedPermissions, @NonNull @NonNull Set<RestrictedPermission> newRestrictedPermissions) Checks if the existing and new restrictedPermission sets are equal.- Parameters:
existingRestrictedPermissions- the existing user restrictedPermissionsnewRestrictedPermissions- the updated user restrictedPermissions- Returns:
- true if the sets are equal, otherwise false
-
updateRestrictedRoles
protected boolean updateRestrictedRoles(@NonNull @NonNull User user, @NonNull @NonNull AccountMemberRestrictionUpdateEvent event) Perform any necessary updates of the user restrictedRoles. If no update is necessary, this will return false.- Parameters:
user- The existing userevent- The event that contains a potentially updated user- Returns:
- true if the user should be updated, else false
-
areRestrictedRolesEqual
protected boolean areRestrictedRolesEqual(@NonNull @NonNull Set<RestrictedRole> existingRestrictedRoles, @NonNull @NonNull Set<RestrictedRole> newRestrictedRoles) Checks if the existing and new restrictedRole sets are equal.- Parameters:
existingRestrictedRoles- the existing restrictedRolesnewRestrictedRoles- the updated restrictedRoles- Returns:
- true if the sets are equal, otherwise false
-
getUserService
-
getUserResourceLockService
-