java.lang.Object
com.broadleafcommerce.adminuser.resource.web.endpoint.AdminUserEndpoint

@FrameworkRestController @FrameworkMapping("/users") @DataRouteByExample(AdminUser.class) public class AdminUserEndpoint extends Object
Endpoints for CRUD operations on User.

Access control for user operations are based on application context (the applicationId found in the context request) for each endpoint. To access a user, application context must either be global or an application that the user is assigned to.

Author:
Samarth Dhruva (samarthd)
  • Field Details

  • Constructor Details

  • Method Details

    • getUser

      @FrameworkGetMapping("/my-preferences") @Policy(permissionRoots={"ADMIN_USER","ADMIN_USER_PROFILE"}, identityTypes=ADMIN) public AdminUser getUser(Principal principal, @ContextOperation(READ) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • updateUserPreferences

      @Deprecated(since="2.3.0") @FrameworkPatchMapping("/my-preferences") @Policy(permissionRoots={"ADMIN_USER","ADMIN_USER_PROFILE"}, operationTypes=UPDATE, identityTypes=ADMIN) public AdminUser updateUserPreferences(Principal principal, @RequestBody UserPreferences preferences, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated since 2.3.0, in favor of replaceUserPreferences(Principal, UserPreferences, ContextInfo).

      As of 2.3.0, AdminUserService does not currently implement CrudEntityService, so when updating Admin User Preferences (namely just email, phone, and default application ID), we cannot call CrudEntityService.update(String, Object, ContextInfo) in order to quickly and neatly update just the field we are concerned with. Instead, the entire AdminUser is being updated field by field and then persisted. At present, a PATCH operation will not allow the Admin User values to be updated properly since it only passes in values of fields that have been changed — this would lead to previously populated fields being emptied since AdminUserService.

      In order for a PATCH request operation to work, we would have to mimic a REPLACE operation by passing in a version of UserPreferences that has all persisted values for the current AdminUser, but has affected fields updated by the passed in request values. Since a PUT request operation already works this way, it should be the default method for updating Admin User Preferences.

    • replaceUserPreferences

      @FrameworkPutMapping("/my-preferences") @Policy(permissionRoots={"ADMIN_USER","ADMIN_USER_PROFILE"}, operationTypes=UPDATE, identityTypes=ADMIN) public AdminUser replaceUserPreferences(Principal principal, @RequestBody UserPreferences preferences, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • readAllUsers

      @FrameworkGetMapping @Policy(permissionRoots="ADMIN_USER") public org.springframework.data.domain.Page<AdminUser> readAllUsers(@RequestParam(value="q",required=false) String name, @PageableDefault(size=50) org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters, @ContextOperation(READ) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getUser

      @FrameworkGetMapping("/{id}") @Policy(permissionRoots="ADMIN_USER") public AdminUser getUser(@PathVariable("id") String id, @ContextOperation(READ) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • createUser

      @FrameworkPostMapping @Policy(permissionRoots="ADMIN_USER") public AdminUser createUser(@RequestBody AdminUser user, @ContextOperation(CREATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • replaceUser

      @FrameworkPutMapping("/{id}") @Policy(permissionRoots="ADMIN_USER") public AdminUser replaceUser(@PathVariable("id") String id, @RequestBody AdminUser user, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • deleteUser

      @FrameworkDeleteMapping("/{id}") @Policy(permissionRoots="ADMIN_USER") public void deleteUser(@PathVariable("id") String id, @ContextOperation(DELETE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • setAuthenticationUtils

      @Autowired public void setAuthenticationUtils(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils)
    • getAuthenticationUtils

      protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()