3 Replies Latest reply on Jun 10, 2008 3:15 PM by nickarls

    Seam security s:hasRole in UI

    gjeudy

      Hi,


      I use Seam 2.0.1GA and I found out an incorrect tip in the Seam security chapter: UI security.


      I tried using:


      <h:commandButton value="Create Rel Pkg" rendered="#{s.hasRole('USER')}"
      
                               action="#{packageAdminAction.startCreateReleasePackage}" />



      but it always evaluated to false. So I changed it to:


      <<h:commandButton value="Create Rel Pkg" rendered="#{identity.hasRole('USER')}"
      
                               action="#{packageAdminAction.startCreateReleasePackage}" />



      and now it works.


      Can someone please confirm this is a bug? The s.hasRole expression is properly processed in @Restrict annotation on component security.


      I suggest that the UI usage be made consistent with component security @Restrict usage.


      Thanks,
      -Guillaume

        • 1. Re: Seam security s:hasRole in UI

          Documentation:



          s:hasRole(




          Your code:



          s.hasRole(




          Does that answer your question?

          • 2. Re: Seam security s:hasRole in UI
            gjeudy

            D'oh, thanks for seeing the obvious. works great with s:hasRole


            Now comes the next question, I didn't know you could use semi-colon notation in an EL expression, can somebody tell me what makes it different from the regular dot (.) notation ?


            It's often good to know why things are such a way in order to remember it.


            Thanks,
            -Guillaume

            • 3. Re: Seam security s:hasRole in UI
              nickarls

              I don't think a colon has any special meaning in normal EL but Seam has an own EL-resolver so they are free to use whatever they like. It is probably needed anyway in order to separate it from a normal EL-resolve involving an variable named s.