<div dir="ltr">hangout result: no need to add lot&#39;s of IFs - since only the &quot;finder&quot; for PushApplications will have a different behavior (meaning for admin -&gt; all; for developer -&gt; just my own apps)<div>At this point no need of a specific admin-ish endpoint, nor no need to create a new &quot;admin&quot; UI.</div><div><br></div><div>However, once we are in a need to do more tweaks for an admin user (e.g. in a year or so): yes, there should not be any more IFs but a more cleaner approcah, like extra classes as Bruno did suggest.</div><div><br></div><div>Cheers!</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 10, 2014 at 3:40 PM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">&quot;you guys&quot; :)<div><br></div><div>I think the only different between &#39;admin&#39; and developer&#39; role is really the result of the &quot;findAllPushApplicationsForDeveloper()&quot;</div><div><br></div><div>everything else would be the same</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 10, 2014 at 3:36 PM, Bruno Oliveira <span dir="ltr">&lt;<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I really want to confirm this. So this is what you guys want:<br>
<br>
- <a href="https://gist.github.com/abstractj/3873482db8f4535aefe0#file-pushapplicationendpoint-java-L109" target="_blank">https://gist.github.com/abstractj/3873482db8f4535aefe0#file-pushapplicationendpoint-java-L109</a><br>
- <a href="https://gist.github.com/abstractj/3873482db8f4535aefe0#file-pushapplicationendpoint-java-L132" target="_blank">https://gist.github.com/abstractj/3873482db8f4535aefe0#file-pushapplicationendpoint-java-L132</a><br>
- <a href="https://gist.github.com/abstractj/3873482db8f4535aefe0#file-pushapplicationendpoint-java-L172" target="_blank">https://gist.github.com/abstractj/3873482db8f4535aefe0#file-pushapplicationendpoint-java-L172</a><br>
- <a href="https://gist.github.com/abstractj/3873482db8f4535aefe0#file-pushapplicationendpoint-java-L199" target="_blank">https://gist.github.com/abstractj/3873482db8f4535aefe0#file-pushapplicationendpoint-java-L199</a><br>
<br>
And with more methods we add more IFs, right?<br>
<div><div><br>
On 2014-10-10, Matthias Wessendorf wrote:<br>
&gt; On Thu, Oct 9, 2014 at 9:58 PM, Bruno Oliveira &lt;<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; On 2014-10-09, Matthias Wessendorf wrote:<br>
&gt; &gt; &gt; On Thu, Oct 9, 2014 at 6:04 PM, Sébastien Blanc &lt;<a href="mailto:scm.blanc@gmail.com" target="_blank">scm.blanc@gmail.com</a>&gt;<br>
&gt; &gt; wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Another option could be :<br>
&gt; &gt; &gt; &gt; - no change or addition of any endpoint<br>
&gt; &gt; &gt; &gt; -no change on the angular side<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Since the result is the same : we want a list of applications (for<br>
&gt; &gt; admin<br>
&gt; &gt; &gt; &gt; there is just no restriction on developer that owns it)<br>
&gt; &gt; &gt; &gt; But in the service layer when retrieving the applications we check the<br>
&gt; &gt; &gt; &gt; role (do we have a method hasRole(string) ? ) to see if we add the<br>
&gt; &gt; criteria<br>
&gt; &gt; &gt; &gt; of developer.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; yeah, that;s what I had in my email from last night as well. the service<br>
&gt; &gt; &gt; returns a list of applications.<br>
&gt; &gt;<br>
&gt; &gt; I think this is very clear to everyone and the basic principle of this<br>
&gt; &gt; jira.<br>
&gt; &gt;<br>
&gt; &gt; &gt; Inside we handle the different cases:<br>
&gt; &gt; &gt; - admin<br>
&gt; &gt; &gt;    Select all (e.g. &quot;select pa from PushApplication pa&quot;)<br>
&gt; &gt; &gt; -developer<br>
&gt; &gt; &gt;    select &#39;my apps&#39; (e.g. &quot;select pa from PushApplication pa where<br>
&gt; &gt; &gt; pa.developer = :loginName&quot;)<br>
&gt; &gt;<br>
&gt; &gt; This is the recommendation from KC documentation<br>
&gt; &gt;<br>
&gt; &gt; <a href="http://docs.jboss.org/keycloak/docs/1.0.2.Final/userguide/html/ch07.html#d4e611" target="_blank">http://docs.jboss.org/keycloak/docs/1.0.2.Final/userguide/html/ch07.html#d4e611</a><br>
&gt; &gt; .<br>
&gt; &gt;<br>
&gt;<br>
&gt; I understand their example, but we don&#39;t really (within UPS) have a<br>
&gt; completely different UI between &quot;admin&quot; and &quot;developer&quot; roles.<br>
&gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt; So what do you guys suggest is: If I have several methods to validate<br>
&gt; &gt; multiple roles, just add if/else all along the UPS code? And if I have a<br>
&gt; &gt; new<br>
&gt; &gt; role, include more ifs?<br>
&gt; &gt;<br>
&gt; &gt; I think it can be done inject the SecurityContext, have to check with<br>
&gt; &gt; Stian and Bill. But it doesn&#39;t seem right.<br>
&gt; &gt;<br>
&gt;<br>
&gt; might not be the most elegant, but looks like it avoids adding too much new<br>
&gt; code. Especially since the UI for &#39;admin&#39; and &#39;developer&#39; is pretty much<br>
&gt; the same.<br>
&gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; -Matthias<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Envoyé de mon iPhone<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; Le 9 oct. 2014 à 17:45, Bruno Oliveira &lt;<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>&gt; a<br>
&gt; &gt; écrit :<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; Good morning, moving forward with<br>
&gt; &gt; &gt; &gt; &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; &gt; &gt; &gt; &gt; recommended approach for admin-ui.<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; Have separated endpoints for the admin like:<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; 1.<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; @RolesAllowed(&quot;admin&quot;)<br>
&gt; &gt; &gt; &gt; &gt; @Path(&quot;/admin/applications&quot;)<br>
&gt; &gt; &gt; &gt; &gt; public class AdminApplicationEndpoint extends AbstractBaseEndpoint {<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;    @GET<br>
&gt; &gt; &gt; &gt; &gt;    @Produces(MediaType.APPLICATION_JSON)<br>
&gt; &gt; &gt; &gt; &gt;    public Response listAllPushApplications(){<br>
&gt; &gt; &gt; &gt; &gt;        //queries<br>
&gt; &gt; &gt; &gt; &gt;    }<br>
&gt; &gt; &gt; &gt; &gt; }<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; Or introduce a new method inside the current PushApplicationEndpoint:<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; 2.<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;    @GET<br>
&gt; &gt; &gt; &gt; &gt;    @Produces(MediaType.APPLICATION_JSON)<br>
&gt; &gt; &gt; &gt; &gt;    @RolesAllowed(&quot;admin&quot;)<br>
&gt; &gt; &gt; &gt; &gt;    public Response listAllPushApplications(){<br>
&gt; &gt; &gt; &gt; &gt;      //queries<br>
&gt; &gt; &gt; &gt; &gt;    }<br>
&gt; &gt; &gt; &gt; &gt;    // READ<br>
&gt; &gt; &gt; &gt; &gt;    @GET<br>
&gt; &gt; &gt; &gt; &gt;    @Produces(MediaType.APPLICATION_JSON)<br>
&gt; &gt; &gt; &gt; &gt;    public Response listAllPushApplicationsByUsername(@Context<br>
&gt; &gt; &gt; &gt; HttpServletRequest request) {<br>
&gt; &gt; &gt; &gt; &gt;        return<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; Response.ok(pushAppService.findAllPushApplicationsForDeveloper(extractUsername(request))).build();<br>
&gt; &gt; &gt; &gt; &gt;    }<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; If the option 2 is the correct. How the Angular.js service would look<br>
&gt; &gt; &gt; &gt; &gt; like? Once the username is not informed as argument on<br>
&gt; &gt; &gt; &gt; &gt; pushApplicationService.js, because for obvious reasons it can be<br>
&gt; &gt; &gt; &gt; &gt; retrieved with HttpServletRequest.<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; One of my poor ideas due to my &quot;amazing&quot; Angular skills would be to<br>
&gt; &gt; do<br>
&gt; &gt; &gt; &gt; &gt; something like:<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;    @GET<br>
&gt; &gt; &gt; &gt; &gt;    @Produces(MediaType.APPLICATION_JSON)<br>
&gt; &gt; &gt; &gt; &gt;    @RolesAllowed(&quot;admin&quot;)<br>
&gt; &gt; &gt; &gt; &gt;    @Path(&quot;/all&quot;)<br>
&gt; &gt; &gt; &gt; &gt;    public Response listAllPushApplications(){<br>
&gt; &gt; &gt; &gt; &gt;      //queries<br>
&gt; &gt; &gt; &gt; &gt;    }<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; And:<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; backendMod.factory(&#39;pushApplication&#39;, function ($resource) {<br>
&gt; &gt; &gt; &gt; &gt;  return $resource(&#39;rest/applications/all/:verb&#39;, {<br>
&gt; &gt; &gt; &gt; &gt; .....<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; Help?<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; --<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; abstractj<br>
&gt; &gt; &gt; &gt; &gt; PGP: 0x84DC9914<br>
&gt; &gt; &gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; &gt; &gt; aerogear-dev mailing list<br>
&gt; &gt; &gt; &gt; &gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
&gt; &gt; &gt; &gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; &gt; aerogear-dev mailing list<br>
&gt; &gt; &gt; &gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
&gt; &gt; &gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; --<br>
&gt; &gt; &gt; Matthias Wessendorf<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
&gt; &gt; &gt; sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
&gt; &gt; &gt; twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a><br>
&gt; &gt;<br>
&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; aerogear-dev mailing list<br>
&gt; &gt; &gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
&gt; &gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt;<br>
&gt; &gt; abstractj<br>
&gt; &gt; PGP: 0x84DC9914<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; aerogear-dev mailing list<br>
&gt; &gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Matthias Wessendorf<br>
&gt;<br>
&gt; blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
&gt; sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
&gt; twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a><br>
<br>
&gt; _______________________________________________<br>
&gt; aerogear-dev mailing list<br>
&gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">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>
--<br>
<br>
abstractj<br>
PGP: 0x84DC9914<br>
_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">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></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>