1 Reply Latest reply on Oct 24, 2009 6:50 PM by Tathagat Tathagat

    hasPermission override Identity

    Tathagat Tathagat Newbie

      Hello all.
      I am trying to override Identity so I can write my own hasPermission method.


      My class


      @Name("org.jboss.seam.security.identity")
      @Scope(ScopeType.SESSION)
      @Install(precedence=Install.APPLICATION)
      @BypassInterceptors
      @Startup
      public class MyIdentity extends Identity
           @Override
           public boolean hasPermission(String name, String action, Object...arg)
           {      
                logger.debug("####################################"+":"+name+":"+action);
                return !securityEnabled;
           }
      



      On front end I am trying to use it like


      <s:link value="New Client" view="/members/newClient.xhtml" disabled="#{(not identity.loggedIn) or (not s:hasPermission('clientAction','createNewClient'))}" propagation="none"/>



      I also tried


      <s:link value="New Client" view="/members/newClient.xhtml" disabled="#{(not identity.loggedIn) or (not s:hasPermission('clientAction','createNewClient',null))}" propagation="none"/>



      In my components.xml



      <security:identity authenticate-method="#{authenticator.authenticate}"/>



      And in my authenticator I pass in an instance of MyIdentity


      @In     MyIdentity identity;



      The log statement never gets printed from MyIdentity - hasPermission method. What am I doing wrong here?


      Thanks a lot in advance for your help


      Regards
      Tathagat