[aerogear-dev] Admin endpoints

Bruno Oliveira bruno at abstractj.org
Thu Oct 9 11:45:44 EDT 2014


Good morning, moving forward with
https://issues.jboss.org/browse/AGPUSH-1036. What is the most
recommended approach for admin-ui.

Have separated endpoints for the admin like:

1.

@RolesAllowed("admin")
@Path("/admin/applications")
public class AdminApplicationEndpoint extends AbstractBaseEndpoint {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response listAllPushApplications(){
        //queries
    }
}

Or introduce a new method inside the current PushApplicationEndpoint:

2.

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @RolesAllowed("admin")
    public Response listAllPushApplications(){
      //queries
    }
    // READ
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response listAllPushApplicationsByUsername(@Context HttpServletRequest request) {
        return Response.ok(pushAppService.findAllPushApplicationsForDeveloper(extractUsername(request))).build();
    }


If the option 2 is the correct. How the Angular.js service would look
like? Once the username is not informed as argument on
pushApplicationService.js, because for obvious reasons it can be
retrieved with HttpServletRequest.

One of my poor ideas due to my "amazing" Angular skills would be to do
something like:

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @RolesAllowed("admin")
    @Path("/all")
    public Response listAllPushApplications(){
      //queries
    }

And:

backendMod.factory('pushApplication', function ($resource) {
  return $resource('rest/applications/all/:verb', {
.....


Help?






--

abstractj
PGP: 0x84DC9914


More information about the aerogear-dev mailing list