@Test public void testCreatePrivilege_repositoryContentSelector() { when(authorizationManager.getPrivilege("name")).thenThrow(new NoSuchPrivilegeException("name")); ApiPrivilegeRepositoryContentSelectorRequest apiPrivilege = new ApiPrivilegeRepositoryContentSelectorRequest("name", "description", "format1", "repository1", "contentSelector", Arrays .asList(PrivilegeAction.BROWSE, PrivilegeAction.READ, PrivilegeAction.DELETE, PrivilegeAction.EDIT, PrivilegeAction.ADD)); underTest.createPrivilege(apiPrivilege); ArgumentCaptor<Privilege> argument = ArgumentCaptor.forClass(Privilege.class); verify(authorizationManager).addPrivilege(argument.capture()); assertPrivilege(argument.getValue(), "name", "description", FORMAT_KEY, "format1", REPOSITORY_KEY, "repository1", CSEL_KEY, "contentSelector", ACTIONS_KEY, "browse,read,delete,edit,add"); }
@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);  }