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 Details

  • Method Details

    • handle

      public void handle(@NonNull @NonNull AccountMemberRestrictionUpdateEvent event)
      Description copied from interface: AccountMemberRestrictionChangeRequestHandler
      Handles an AccountMemberRestrictionUpdateEvent to update the restrictions if applicable.
      Specified by:
      handle in interface AccountMemberRestrictionChangeRequestHandler
      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 user
      event - 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 user
      event - 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 restrictions
      newRestrictions - 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 user
      event - 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 restrictedPermissions
      newRestrictedPermissions - 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 user
      event - 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 restrictedRoles
      newRestrictedRoles - the updated restrictedRoles
      Returns:
      true if the sets are equal, otherwise false
    • getUserService

      protected UserService<User> getUserService()
    • getUserResourceLockService

      protected UserResourceLockService<User> getUserResourceLockService()