Results 1 to 2 of 2

Thread: Form field behavior based on user profile

  1. #1
    Join Date
    Aug 2004
    Posts
    10

    Default Form field behavior based on user profile

    The problem:
    I have to present an HTTP FORM built with Velocity

    User has requested me that certain form fields enable or disable some values or ranges based on "who" is completing the form (a seller has a limit of 100u$, a supervisor 300u$ and a manager has no limit, for instance)



    The solution:
    ...

    The question:
    Is Acegi Sec Sys adecuate to handle the problem? Some suggestion about how invoke it from Velocity?
    Diego Dagum
    Self-confidence, Chile

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    The stock-standard Acegi Security approach is to have a ThreadLocal bound object (called ContextHolder) which allows access to the presently logged on user via ((SecureContext) ContextHolder.getContext()).getAuthentication(). The Authentication has a getAuthorities() method which provides the GrantedAuthority[]s.

    So, all you need is a Velocity-friendly way of accessing this. If you subclass org.springframework.web.servlet.view.velocity.Velo cityView and implement exposeHelpers(Context velocityContext, HttpServletRequest request) you can inject a helper bean into the Velocity context. There might be another way of adding helpers, but that's the way we do it here anyway. The helper bean could be similar to the Acegi Security taglib.

Similar Threads

  1. Replies: 3
    Last Post: Jun 8th, 2010, 03:27 AM
  2. Problem with HibernateInterceptor
    By prane in forum Data
    Replies: 5
    Last Post: Oct 16th, 2007, 08:01 AM
  3. LDAPPasswordAuthenticationDao problem
    By benoit_m35 in forum Security
    Replies: 15
    Last Post: Jan 11th, 2006, 07:04 AM
  4. Replies: 3
    Last Post: Sep 22nd, 2005, 10:14 AM
  5. Not updating a form field on setFormObject()?
    By SCWells72 in forum Swing
    Replies: 13
    Last Post: Aug 28th, 2005, 12:43 PM

Posting Permissions

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