3 Replies Latest reply on Nov 30, 2007 4:02 AM by rizzojo

    Usage of @Restrict annotation with method parameters

    rizzojo

      Hi,

      I'm investigating Seam and WebBeans authorization aspects.
      I've a simple question witch answer is not in the Seam reference guide.

      In the Seam v2 reference guide,
      http://docs.jboss.com/seam/2.0.0.GA/reference/en/html/security.html#d0e7113
      The following example is given:

      @Name("account")
      public class AccountAction {
       @In Account selectedAccount;
       @Restrict("#{s:hasPermission('account','modify',selectedAccount)}")
       public void modify() {
       selectedAccount.modify();
       }
      }
      


      The interesting part of this is the use of "selectedAccount" attribute injected by seam.
      My question is: is it possible to use a method parameter instead of an attribute ?

      Something like this:
      @Name("account")
      public class AccountService {
      @Restrict("#{s:hasPermission('account','modify',selectedAccount)}")
       public void modifyAccount(Account selectedAccount) {
       selectedAccount.modify();
       }
      }
      


      Thank you.
      John.