@Test public void testCreatePrivilege_repositoryContentSelectorInvalidContentSelector() { when(authorizationManager.getPrivilege("name")).thenThrow(new NoSuchPrivilegeException("name")); ApiPrivilegeRepositoryContentSelectorRequest apiPrivilege = new ApiPrivilegeRepositoryContentSelectorRequest("repo", "description", "format1", "repository1", "invalid", Arrays .asList(PrivilegeAction.BROWSE, PrivilegeAction.READ, PrivilegeAction.DELETE, PrivilegeAction.EDIT, PrivilegeAction.ADD)); try { underTest.createPrivilege(apiPrivilege); fail("create should have failed as content selector is invalid."); } catch (WebApplicationMessageException e) { assertThat(e.getResponse().getStatus(), is(400)); assertThat(e.getResponse().getMediaType(), is(MediaType.APPLICATION_JSON_TYPE)); assertThat(e.getResponse().getEntity().toString(), is("\"Invalid selector 'invalid' supplied.\"")); } }
@Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("repository-admin") public Response createPrivilege(final ApiPrivilegeRepositoryAdminRequest privilege) { return doCreate(RepositoryAdminPrivilegeDescriptor.TYPE, privilege); }
RepositoryPrivilegeApiResource extends PrivilegeApiResourceSupport implements Resource, RepositoryPrivilegeApiResourceDoc { @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("repository-admin") public Response createPrivilege(final ApiPrivilegeRepositoryAdminRequest privilege) { return doCreate(RepositoryAdminPrivilegeDescriptor.TYPE, privilege); } }
RepositoryPrivilegeApiResource extends PrivilegeApiResourceSupport implements Resource, RepositoryPrivilegeApiResourceDoc { @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("repository-admin") public Response createPrivilege(final ApiPrivilegeRepositoryAdminRequest privilege) { return doCreate(RepositoryAdminPrivilegeDescriptor.TYPE, privilege); } @Inject  RepositoryPrivilegeApiResource(final SecuritySystem securitySystem,
                                        final Map<String, PrivilegeDescriptor> privilegeDescriptors); }
RepositoryPrivilegeApiResource extends PrivilegeApiResourceSupport implements Resource, RepositoryPrivilegeApiResourceDoc { @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("repository-admin") public Response createPrivilege(final ApiPrivilegeRepositoryAdminRequest privilege) { return doCreate(RepositoryAdminPrivilegeDescriptor.TYPE, privilege); } @Inject  RepositoryPrivilegeApiResource(final SecuritySystem securitySystem,
                                        final Map<String, PrivilegeDescriptor> privilegeDescriptors); @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("repository-admin") Response createPrivilege(final ApiPrivilegeRepositoryAdminRequest privilege); @Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:privileges:update") @Path("repository-admin/{privilegeId}") void updatePrivilege(@PathParam("privilegeId") final String privilegeId,
                              final ApiPrivilegeRepositoryAdminRequest privilege); @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("repository-view") Response createPrivilege(final ApiPrivilegeRepositoryViewRequest privilege); @Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:privileges:update") @Path("repository-view/{privilegeId}") void updatePrivilege(@PathParam("privilegeId") final String privilegeId,
                              final ApiPrivilegeRepositoryViewRequest privilege); @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("repository-content-selector") Response createPrivilege(final ApiPrivilegeRepositoryContentSelectorRequest privilege); @Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:privileges:update") @Path("repository-content-selector/{privilegeId}") void updatePrivilege(@PathParam("privilegeId") final String privilegeId,
                              final ApiPrivilegeRepositoryContentSelectorRequest privilege); }
RepositoryPrivilegeApiResource extends PrivilegeApiResourceSupport implements Resource, RepositoryPrivilegeApiResourceDoc { @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("repository-admin") public Response createPrivilege(final ApiPrivilegeRepositoryAdminRequest privilege) { return doCreate(RepositoryAdminPrivilegeDescriptor.TYPE, privilege); } @Inject  RepositoryPrivilegeApiResource(final SecuritySystem securitySystem,
                                        final Map<String, PrivilegeDescriptor> privilegeDescriptors); @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("repository-admin") Response createPrivilege(final ApiPrivilegeRepositoryAdminRequest privilege); @Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:privileges:update") @Path("repository-admin/{privilegeId}") void updatePrivilege(@PathParam("privilegeId") final String privilegeId,
                              final ApiPrivilegeRepositoryAdminRequest privilege); @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("repository-view") Response createPrivilege(final ApiPrivilegeRepositoryViewRequest privilege); @Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:privileges:update") @Path("repository-view/{privilegeId}") void updatePrivilege(@PathParam("privilegeId") final String privilegeId,
                              final ApiPrivilegeRepositoryViewRequest privilege); @Override @POST @RequiresAuthentication @RequiresPermissions("nexus:privileges:create") @Path("repository-content-selector") Response createPrivilege(final ApiPrivilegeRepositoryContentSelectorRequest privilege); @Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:privileges:update") @Path("repository-content-selector/{privilegeId}") void updatePrivilege(@PathParam("privilegeId") final String privilegeId,
                              final ApiPrivilegeRepositoryContentSelectorRequest privilege);  }