<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 9, 2014 at 6:04 PM, Sébastien Blanc <span dir="ltr">&lt;<a href="mailto:scm.blanc@gmail.com" target="_blank">scm.blanc@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Another option could be :<br>
- no change or addition of any endpoint<br>
-no change on the angular side<br>
<br>
Since the result is the same : we want a list of applications (for admin there is just no restriction on developer that owns it)<br>
But in the service layer when retrieving the applications we check the role (do we have a method hasRole(string) ? ) to see if we add the criteria of developer.<br></blockquote><div><br></div><div>yeah, that;s what I had in my email from last night as well. the service returns a list of applications.</div><div>Inside we handle the different cases:</div><div>- admin</div><div>   Select all (e.g. &quot;select pa from PushApplication pa&quot;)</div><div>-developer</div><div>   select &#39;my apps&#39; (e.g. &quot;select pa from PushApplication pa where pa.developer = :loginName&quot;)</div><div><br></div><div><br></div><div>-Matthias</div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Envoyé de mon iPhone<br>
<br>
&gt; Le 9 oct. 2014 à 17:45, Bruno Oliveira &lt;<a href="mailto:bruno@abstractj.org">bruno@abstractj.org</a>&gt; a écrit :<br>
<div class=""><div class="h5">&gt;<br>
&gt; Good morning, moving forward with<br>
&gt; <a href="https://issues.jboss.org/browse/AGPUSH-1036" target="_blank">https://issues.jboss.org/browse/AGPUSH-1036</a>. What is the most<br>
&gt; recommended approach for admin-ui.<br>
&gt;<br>
&gt; Have separated endpoints for the admin like:<br>
&gt;<br>
&gt; 1.<br>
&gt;<br>
&gt; @RolesAllowed(&quot;admin&quot;)<br>
&gt; @Path(&quot;/admin/applications&quot;)<br>
&gt; public class AdminApplicationEndpoint extends AbstractBaseEndpoint {<br>
&gt;<br>
&gt;    @GET<br>
&gt;    @Produces(MediaType.APPLICATION_JSON)<br>
&gt;    public Response listAllPushApplications(){<br>
&gt;        //queries<br>
&gt;    }<br>
&gt; }<br>
&gt;<br>
&gt; Or introduce a new method inside the current PushApplicationEndpoint:<br>
&gt;<br>
&gt; 2.<br>
&gt;<br>
&gt;    @GET<br>
&gt;    @Produces(MediaType.APPLICATION_JSON)<br>
&gt;    @RolesAllowed(&quot;admin&quot;)<br>
&gt;    public Response listAllPushApplications(){<br>
&gt;      //queries<br>
&gt;    }<br>
&gt;    // READ<br>
&gt;    @GET<br>
&gt;    @Produces(MediaType.APPLICATION_JSON)<br>
&gt;    public Response listAllPushApplicationsByUsername(@Context HttpServletRequest request) {<br>
&gt;        return Response.ok(pushAppService.findAllPushApplicationsForDeveloper(extractUsername(request))).build();<br>
&gt;    }<br>
&gt;<br>
&gt;<br>
&gt; If the option 2 is the correct. How the Angular.js service would look<br>
&gt; like? Once the username is not informed as argument on<br>
&gt; pushApplicationService.js, because for obvious reasons it can be<br>
&gt; retrieved with HttpServletRequest.<br>
&gt;<br>
&gt; One of my poor ideas due to my &quot;amazing&quot; Angular skills would be to do<br>
&gt; something like:<br>
&gt;<br>
&gt;    @GET<br>
&gt;    @Produces(MediaType.APPLICATION_JSON)<br>
&gt;    @RolesAllowed(&quot;admin&quot;)<br>
&gt;    @Path(&quot;/all&quot;)<br>
&gt;    public Response listAllPushApplications(){<br>
&gt;      //queries<br>
&gt;    }<br>
&gt;<br>
&gt; And:<br>
&gt;<br>
&gt; backendMod.factory(&#39;pushApplication&#39;, function ($resource) {<br>
&gt;  return $resource(&#39;rest/applications/all/:verb&#39;, {<br>
&gt; .....<br>
&gt;<br>
&gt;<br>
&gt; Help?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt;<br>
&gt; abstractj<br>
&gt; PGP: 0x84DC9914<br>
&gt; _______________________________________________<br>
&gt; aerogear-dev mailing list<br>
&gt; <a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
<br>
_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div>