@Test public void testDeleteUsers() throws Exception { underTest.deleteUser("jsmith"); verify(securitySystem).deleteUser("jsmith", UserManager.DEFAULT_SOURCE); }
@Override @DELETE @Path("{userId}") @RequiresAuthentication @RequiresPermissions("nexus:users:delete") public void deleteUser(@PathParam("userId") final String userId) { User user = null; try { user = securitySystem.getUser(userId); securitySystem.deleteUser(userId, user.getSource()); } catch (NoSuchUserManagerException e) { String source = user.getSource() != null ? user.getSource() : ""; log.error("Unable to locate source: {} for userId: {}", source, userId, e); throw createNoSuchUserManagerException(source); } catch (UserNotFoundException e) { log.debug("Unable to locate userId: {}", userId, e); throw createUnknownUserException(userId); } }
UserApiResource extends ComponentSupport implements Resource, UserApiResourceDoc { @Override @DELETE @Path("{userId}") @RequiresAuthentication @RequiresPermissions("nexus:users:delete") public void deleteUser(@PathParam("userId") final String userId) { User user = null; try { user = securitySystem.getUser(userId); securitySystem.deleteUser(userId, user.getSource()); } catch (NoSuchUserManagerException e) { String source = user.getSource() != null ? user.getSource() : ""; log.error("Unable to locate source: {} for userId: {}", source, userId, e); throw createNoSuchUserManagerException(source); } catch (UserNotFoundException e) { log.debug("Unable to locate userId: {}", userId, e); throw createUnknownUserException(userId); } } }
UserApiResource extends ComponentSupport implements Resource, UserApiResourceDoc { @Override @DELETE @Path("{userId}") @RequiresAuthentication @RequiresPermissions("nexus:users:delete") public void deleteUser(@PathParam("userId") final String userId) { User user = null; try { user = securitySystem.getUser(userId); securitySystem.deleteUser(userId, user.getSource()); } catch (NoSuchUserManagerException e) { String source = user.getSource() != null ? user.getSource() : ""; log.error("Unable to locate source: {} for userId: {}", source, userId, e); throw createNoSuchUserManagerException(source); } catch (UserNotFoundException e) { log.debug("Unable to locate userId: {}", userId, e); throw createUnknownUserException(userId); } } @Inject  UserApiResource(final SecuritySystem securitySystem, final AdminPasswordFileManager adminPasswordFileManager); }
UserApiResource extends ComponentSupport implements Resource, UserApiResourceDoc { @Override @DELETE @Path("{userId}") @RequiresAuthentication @RequiresPermissions("nexus:users:delete") public void deleteUser(@PathParam("userId") final String userId) { User user = null; try { user = securitySystem.getUser(userId); securitySystem.deleteUser(userId, user.getSource()); } catch (NoSuchUserManagerException e) { String source = user.getSource() != null ? user.getSource() : ""; log.error("Unable to locate source: {} for userId: {}", source, userId, e); throw createNoSuchUserManagerException(source); } catch (UserNotFoundException e) { log.debug("Unable to locate userId: {}", userId, e); throw createUnknownUserException(userId); } } @Inject  UserApiResource(final SecuritySystem securitySystem, final AdminPasswordFileManager adminPasswordFileManager); @Override @GET @RequiresAuthentication @RequiresPermissions("nexus:users:read") Collection<ApiUser> getUsers(
      @QueryParam("userId") final String userId,
      @QueryParam("source") final String source); @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:users:create") @Validate ApiUser createUser(final ApiCreateUser createUser); @Override @PUT @Path("{userId}") @RequiresAuthentication @RequiresPermissions("nexus:users:update") @Validate void updateUser(@PathParam("userId") final String userId, final ApiUser apiUser); @Override @DELETE @Path("{userId}") @RequiresAuthentication @RequiresPermissions("nexus:users:delete") void deleteUser(@PathParam("userId") final String userId); @Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:*") @Path("{userId}/change-password") @Consumes(MediaType.TEXT_PLAIN) @Validate void changePassword(@PathParam("userId") final String userId, final String password); }
UserApiResource extends ComponentSupport implements Resource, UserApiResourceDoc { @Override @DELETE @Path("{userId}") @RequiresAuthentication @RequiresPermissions("nexus:users:delete") public void deleteUser(@PathParam("userId") final String userId) { User user = null; try { user = securitySystem.getUser(userId); securitySystem.deleteUser(userId, user.getSource()); } catch (NoSuchUserManagerException e) { String source = user.getSource() != null ? user.getSource() : ""; log.error("Unable to locate source: {} for userId: {}", source, userId, e); throw createNoSuchUserManagerException(source); } catch (UserNotFoundException e) { log.debug("Unable to locate userId: {}", userId, e); throw createUnknownUserException(userId); } } @Inject  UserApiResource(final SecuritySystem securitySystem, final AdminPasswordFileManager adminPasswordFileManager); @Override @GET @RequiresAuthentication @RequiresPermissions("nexus:users:read") Collection<ApiUser> getUsers(
      @QueryParam("userId") final String userId,
      @QueryParam("source") final String source); @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:users:create") @Validate ApiUser createUser(final ApiCreateUser createUser); @Override @PUT @Path("{userId}") @RequiresAuthentication @RequiresPermissions("nexus:users:update") @Validate void updateUser(@PathParam("userId") final String userId, final ApiUser apiUser); @Override @DELETE @Path("{userId}") @RequiresAuthentication @RequiresPermissions("nexus:users:delete") void deleteUser(@PathParam("userId") final String userId); @Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:*") @Path("{userId}/change-password") @Consumes(MediaType.TEXT_PLAIN) @Validate void changePassword(@PathParam("userId") final String userId, final String password); static final String ADMIN_USER_ID; }