@Test public void testGetPrivileges_noPrivileges() { when(securitySystem.listPrivileges()).thenReturn(Collections.emptySet()); List<ApiPrivilege> apiPrivileges = new ArrayList<>(underTest.getPrivileges()); assertThat(apiPrivileges.size(), is(0)); }
@Override @GET @RequiresAuthentication @RequiresPermissions("nexus:privileges:read") public List<ApiPrivilege> getPrivileges() { return getSecuritySystem().listPrivileges().stream().map(this::toApiPrivilege) .sorted(Comparator.comparing(ApiPrivilege::getName)).collect(Collectors.toList()); }
PrivilegeApiResource extends PrivilegeApiResourceSupport implements Resource, PrivilegeApiResourceDoc { @Override @GET @RequiresAuthentication @RequiresPermissions("nexus:privileges:read") public List<ApiPrivilege> getPrivileges() { return getSecuritySystem().listPrivileges().stream().map(this::toApiPrivilege) .sorted(Comparator.comparing(ApiPrivilege::getName)).collect(Collectors.toList()); } }
PrivilegeApiResource extends PrivilegeApiResourceSupport implements Resource, PrivilegeApiResourceDoc { @Override @GET @RequiresAuthentication @RequiresPermissions("nexus:privileges:read") public List<ApiPrivilege> getPrivileges() { return getSecuritySystem().listPrivileges().stream().map(this::toApiPrivilege) .sorted(Comparator.comparing(ApiPrivilege::getName)).collect(Collectors.toList()); } @Inject  PrivilegeApiResource(final SecuritySystem securitySystem,
                              final Map<String, PrivilegeDescriptor> privilegeDescriptors); }
PrivilegeApiResource extends PrivilegeApiResourceSupport implements Resource, PrivilegeApiResourceDoc { @Override @GET @RequiresAuthentication @RequiresPermissions("nexus:privileges:read") public List<ApiPrivilege> getPrivileges() { return getSecuritySystem().listPrivileges().stream().map(this::toApiPrivilege) .sorted(Comparator.comparing(ApiPrivilege::getName)).collect(Collectors.toList()); } @Inject  PrivilegeApiResource(final SecuritySystem securitySystem,
                              final Map<String, PrivilegeDescriptor> privilegeDescriptors); @Override @GET @RequiresAuthentication @RequiresPermissions("nexus:privileges:read") List<ApiPrivilege> getPrivileges(); @Override @GET @RequiresAuthentication @RequiresPermissions("nexus:privileges:read") @Path("{privilegeId}") ApiPrivilege getPrivilege(@PathParam("privilegeId") final String privilegeId); @Override @DELETE @RequiresAuthentication @RequiresPermissions("nexus:privileges:delete") @Path("{privilegeId}") void deletePrivilege(@PathParam("privilegeId") final String privilegeId); @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("application") Response createPrivilege(final ApiPrivilegeApplicationRequest privilege); @Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:privileges:update") @Path("application/{privilegeId}") void updatePrivilege(@PathParam("privilegeId") final String privilegeId,
                              final ApiPrivilegeApplicationRequest privilege); @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("wildcard") Response createPrivilege(final ApiPrivilegeWildcardRequest privilege); @Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:privileges:update") @Path("wildcard/{privilegeId}") void updatePrivilege(@PathParam("privilegeId") final String privilegeId,
                              final ApiPrivilegeWildcardRequest privilege); }
PrivilegeApiResource extends PrivilegeApiResourceSupport implements Resource, PrivilegeApiResourceDoc { @Override @GET @RequiresAuthentication @RequiresPermissions("nexus:privileges:read") public List<ApiPrivilege> getPrivileges() { return getSecuritySystem().listPrivileges().stream().map(this::toApiPrivilege) .sorted(Comparator.comparing(ApiPrivilege::getName)).collect(Collectors.toList()); } @Inject  PrivilegeApiResource(final SecuritySystem securitySystem,
                              final Map<String, PrivilegeDescriptor> privilegeDescriptors); @Override @GET @RequiresAuthentication @RequiresPermissions("nexus:privileges:read") List<ApiPrivilege> getPrivileges(); @Override @GET @RequiresAuthentication @RequiresPermissions("nexus:privileges:read") @Path("{privilegeId}") ApiPrivilege getPrivilege(@PathParam("privilegeId") final String privilegeId); @Override @DELETE @RequiresAuthentication @RequiresPermissions("nexus:privileges:delete") @Path("{privilegeId}") void deletePrivilege(@PathParam("privilegeId") final String privilegeId); @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("application") Response createPrivilege(final ApiPrivilegeApplicationRequest privilege); @Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:privileges:update") @Path("application/{privilegeId}") void updatePrivilege(@PathParam("privilegeId") final String privilegeId,
                              final ApiPrivilegeApplicationRequest privilege); @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("wildcard") Response createPrivilege(final ApiPrivilegeWildcardRequest privilege); @Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:privileges:update") @Path("wildcard/{privilegeId}") void updatePrivilege(@PathParam("privilegeId") final String privilegeId,
                              final ApiPrivilegeWildcardRequest privilege);  }