1 Reply Latest reply on Oct 30, 2007 7:21 PM by Shane Bryzak

    How to call a rule into Restrict annotation ?

    Paulo Vitor Rendeiro Newbie

      Hi..

      I have a rule like that...


      rule "Can User Access"
      when
      eval( new Date().before( new Date( Date.parse( "10/31/2007" ) ) )
      then
      c.grant();
      end;


      And I have this Seam Component...

      @Name("customer")
      public class CustomerLogic extends EntityHome<Customer> {
      
       @Restrict( ??? ) <- What should I put here to call my rule ?
       public void doSomething(){
       /* \o\ |o| /o/ */
       }
      
      }
      


      I appreciate r attention ! =)

        • 1. Re: How to call a rule into Restrict annotation ?
          Shane Bryzak Master

          You've got a call to c.grant() in the outcome of your rule, however you don't have a corresponding PermissionCheck in the condition section:

          rule "Can User Access"
          when
           c: PermissionCheck(name == "objectName", action == "access",
           eval( new Date().before( new Date( Date.parse( "10/31/2007" ) ) )
          then
           c.grant();
          end;


          The @Restrict then looks something like this:

          @Restrict("#{s:hasPermission('objectName', 'access', null)}")