Announcement Announcement Module
Collapse
No announcement yet.
@PreAuthorize with ACL on domain object Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @PreAuthorize with ACL on domain object

    Greetings all,

    Iím trying to secure a method on a domain object in an ACL scenario like this:

    Code:
    @RooJpaActiveRecord
    public class Person {
    
        @PreAuthorize("hasPermission(#target, 'WRITE')")
        public void disable() {
            ...
        }
        ...
    But I donít know how to reference the domain object in the expression.
    When I use the above one the PermissionEvaluator is called with a nullpointer
    for the domainObject argument.

    Does anyone have a clue how to do it?

  • #2
    Found the solution... it goes like this:

    Code:
    @RooJpaActiveRecord
    public class Person {
    
        @PreAuthorize("hasPermission(#root.this, 'WRITE')") 
        public void disable() {
            ...
        }
        ...

    Comment

    Working...
    X