org.springmodules.validation.valang.functions
Class InRoleFunction

java.lang.Object
  extended by org.springmodules.validation.valang.functions.AbstractFunction
      extended by org.springmodules.validation.valang.functions.InRoleFunction
All Implemented Interfaces:
Function

public class InRoleFunction
extends AbstractFunction

A function that accepts a one string argument that indicates a security role. This function returns a true if the current user is in the passed in role, and false otherwise.

This method uses Acegi's SecurityContextHolder.getContext().getAuthentication() to get the current user.

This function may be used to apply different validation rules based on the logged in user roles.

Since:
May 25, 2006
Author:
Uri Boness

Constructor Summary
InRoleFunction(Function[] arguments, int line, int column)
           
 
Method Summary
protected  java.lang.Object doGetResult(java.lang.Object target)
           
 
Methods inherited from class org.springmodules.validation.valang.functions.AbstractFunction
definedExactNumberOfArguments, definedMaxNumberOfArguments, definedMinNumberOfArguments, getArguments, getResult, getTemplate, init, isAutowireByName, isAutowireByType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InRoleFunction

public InRoleFunction(Function[] arguments,
                      int line,
                      int column)
Method Detail

doGetResult

protected java.lang.Object doGetResult(java.lang.Object target)
Specified by:
doGetResult in class AbstractFunction


Copyright © 2005. All Rights Reserved.