Results 1 to 2 of 2

Thread: Please help me correct this Spring EL error..

  1. #1
    Join Date
    Apr 2010
    Posts
    14

    Default Please help me correct this Spring EL error..

    Hi there

    i finally managed to integrate spring security acl. I managed to implement a special JPA variant for the existing jdbc aclservices (but this just as a sidenote). However, i cannot get the following expression to work:

    Code:
    @PostAuthorize("returnObject == null " +
    " or (returnObject.directSecurityEnabled and hasPermission(returnObject, 'READ')) " +
    " or (!returnObject.directSecurityEnabled and hasPermission(returnObject.root, 'READ'))")
    I need to add the returnObject.directSecurityEnabled because i use the expression in a generic service, while only like half of the objects handled by the service have acl entries and the other half rely on their respective parents. This is handled with the following abstract method, overwritten in each bean:

    Code:
    /**
    * Does this bean support security?
    * @return boolean
    */
    public final boolean isSecurityEnabled() {
    	return getSecurityEnabled();
    }
    	
    protected abstract boolean getSecurityEnabled();
    There seems to be an error in the EL because i get the following exception:
    Code:
    java.lang.IllegalArgumentException: Failed to evaluate expression 'returnObject == null  or (returnObject.directSecurityEnabled and hasPermission(returnObject, 'READ'))  or (!returnObject.directSecurityEnabled and hasPermission(returnObject.root, 'READ'))'
    	at org.springframework.security.access.expression.ExpressionUtils.evaluateAsBoolean(ExpressionUtils.java:13)
    ...
    Please help me fix this one

  2. #2
    Join Date
    Apr 2010
    Posts
    14

    Default

    ok i solved it myself haha.. tried for hours now but 5 minutes after posting i got it ..

    solution: i should nto have used returnObject.directSecurityEnabled but instead go directly to the method filterObject.isSecurityEnabled().

Posting Permissions

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