Class AdminUserEndpoint
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateUser(AdminUser user, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) voiddeleteUser(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtilsgetUser(Principal principal, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) org.springframework.data.domain.Page<AdminUser>readAllUsers(String name, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) replaceUser(String id, AdminUser user, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) replaceUserPreferences(Principal principal, UserPreferences preferences, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) voidsetAuthenticationUtils(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils) updateUserPreferences(Principal principal, UserPreferences preferences, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.
-
Field Details
-
userSvc
-
-
Constructor Details
-
AdminUserEndpoint
-
-
Method Details
-
getUser
-
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 ofreplaceUserPreferences(Principal, UserPreferences, ContextInfo)Deprecated since 2.3.0, in favor ofreplaceUserPreferences(Principal, UserPreferences, ContextInfo).As of 2.3.0,
AdminUserServicedoes not currently implementCrudEntityService, so when updating Admin User Preferences (namely justemail,phone, anddefault application ID), we cannot callCrudEntityService.update(String, Object, ContextInfo)in order to quickly and neatly update just the field we are concerned with. Instead, the entireAdminUseris 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 sinceAdminUserService.In order for a PATCH request operation to work, we would have to mimic a REPLACE operation by passing in a version of
UserPreferencesthat has all persisted values for the currentAdminUser, 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
-
createUser
-
replaceUser
-
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()
-
replaceUserPreferences(Principal, UserPreferences, ContextInfo)