Results 1 to 2 of 2

Thread: How do i check my object permissions in acl instead of using hasPermission annotation

  1. #1

    Default How do i check my object permissions in acl instead of using hasPermission annotation

    Hi Guys,
    Is there a way to check my class object permissions directly from my code instead of having the annotation model,

    Code:
    @PostAuthorize("hasPermission(returnObject, 'WRITE')")
    public BaseData getSingle(Long id);

  2. #2

    Default

    At-last after several tries i could achieve to get the solution, following is the code

    acl-conf.xml
    Code:
    ...
    <bean class="org.springframework.security.acls.AclPermissionEvaluator" id="permissionEvaluator">
    		<constructor-arg ref="aclService"/>
    </bean>
    ...

    samplecontroller.java
    Code:
        @Autowired
        private PermissionEvaluator permissionEvaluator ;
    
        Permission permission = BasePermission.WRITE;
       permissionEvaluator.hasPermission(authentication,aclObject,permission);
    ....

    Hope this is helpful.

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
  •