Spring The ACL security plugin for grails uses the BasePermission class with 4 basic permissions by default. And uses DefaultFactory to assign these permissions. And the AclPermissionEvaluator where this DefaultFactory is assigned.
When using this approach, everything is in order. I can use
@PreAuthorize("hasPermission(#report, read)")
Here I provided one of the basic permissions, called READ, which is defined in the BasePermission class.
I need my own user permissions. I did:
public class MyPermission extends AbstractPermission{ public static final Permission APPROVE= new MyPermission(1 << 0, 'a');
1) How to properly assign my user permission to use it, how did I use permissions from BasePermission? 2) Should I define my CustomFactory or can I use DefaultFactory? 3) If yes, how to install it for an existing permit specialist?
Another open question. I played with a subclass of BasePermission, but in this case I have to use
@PreAuthorize("hasPermission(#report, 'approve')")
instead
@PreAuthorize("hasPermission(#report, approve)")
4) Why did I get an error in the absence of single quotes?
Class:org.springframework.expression.spel.SpelEvaluationException Message:EL1008E:(pos 28): Field or property 'approve' cannot be found on object of type 'org.springframework.security.access.expression.method.MethodSecurityExpressionRoot'
Thanks in advance!