0 Replies Latest reply on Jul 6, 2010 11:42 AM by Stefan Papin

    rule problem with Principal.getName()

    Stefan Papin Newbie

      Hi everyone,


      I have encounter a problem trying to write a rule for accessing a method.
      I've made a handler for the Principal object following the documentation.


      $p:Principal()

      then I've made a check for a seam element


      $sr:SeamConversationObject($j: idJudet -> ($j==9))

      -- until here everything worked fine --


      This rule is triggered by a permission check that also puts the instance of my SeamConversationObject in the WorkingMemory:


      perm :PermissionCheck( target == $sr, action == "searchConversationObject")

      The problem appears when I try to get my hands on my currentUser object:


      $opr:Operator($username: username -> ($user.equalsIgnoreCase($p.getName())))


      Operator is my user class and it doesn't seem to be accessible inside the rule, and further more if I print out the $p.getName()it returns the name of the role of the user.


      in: System.out.println("################## Id judet Operator: "+ $p.getName());


      out: [7/6/10 18:04:14:062 EEST] 0000001e SystemOut     O ################## Principal: ROLE_SOLICITANT_SEARCH


      This happens even for the command:


      in : System.out.println("################## Id judet Operator: "+ $p);


      I'm trying to understand
      1. Why the Principal is not set right in this case (even though in other parts of the application it returns correct),


      2. Why can't I access my user class from this rule.



      Thank you in advance,


      S.