Results 1 to 4 of 4

Thread: best practice to customize controllers behaviour

  1. #1
    Join Date
    Jan 2010
    Posts
    3

    Default best practice to customize controllers behaviour

    say you have a list of pizzas, some of them are reserved to VIP customers

    how would you filter that list if you were basing on Roo?

    my (ugly) way for now has been to customize the generated menu to point to a custom url ("/pizza/list" instead of just "/pizza") an to create a "myList" method in the PizzaController

    Better ways?

  2. #2
    Join Date
    Sep 2009
    Posts
    101

    Default

    Can't you just use security tags in the jsp? When you iterate through a list of pies, don't print the line if the pie is a vip pie but the customer is not a vip customer.

    Or you could filter out vip pizzas within the controller method itself. You can inject the authenticated user by adding "Authentication auth, " to the method signature (i.e., to PizzaController.list(..)). Then if the auth object doesn't represents a vip customer, you can remove all of the vip pizzas from pizzas collection.

    Using the security tags requires setting "automaticallyMaintainView=false", while modifying your controller method requires pushing the method out of the aspect.

  3. #3
    Join Date
    Jan 2010
    Posts
    3

    Default

    what's "authentication auth" ? can't find it in the docs
    can you point me to some documentation?

  4. #4
    Join Date
    Jan 2010
    Posts
    3

    Default

    sorry, now I got it

    thanks for your help!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •