Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7498251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:24:15+00:00 2026-05-29T19:24:15+00:00

Spring Security ACL plugin for grails by default uses the BasePermission class with 4

  • 0

Spring Security ACL plugin for grails by default uses the BasePermission class with 4 basic permissions. And uses DefaultFactory to assign this permissions. And AclPermissionEvaluator where this DefaultFactory is assigned.

When use this approach all is fine. I can use

    @PreAuthorize("hasPermission(#report, read)")

Here I provided one of the basic permissions called READ which is defined in BasePermission class.

What I need is my own custom permissions.
I’ve done:

     public class MyPermission extends AbstractPermission{

        public static final Permission APPROVE= new MyPermission(1 << 0, 'a');

        //constructors here..  
     }

1) How correctly assign my custom permission to use it like I used permissions from BasePermission?
2)Should I define my CustomFactory or its possible to use DefaultFactory?
3)If yes, how to set it to existing permission evaluator?

Also another open question. I’ve played around with subclass of BasePermission, but in that case I should use

    @PreAuthorize("hasPermission(#report, 'approve')")

instead of just

    @PreAuthorize("hasPermission(#report, approve)")

4)Why in case of no single quotes I got the error?

     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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:24:18+00:00Added an answer on May 29, 2026 at 7:24 pm

    You’re better off extending org.springframework.security.acls.domain.BasePermission since that way you have all the standard permissions plus yours:

    package com.mycompany.myapp.MyPermission;
    
    public class MyPermission extends BasePermission {
    
       public static final Permission APPROVE = new MyPermission(1 << 5, 'V'); // 32
    
       protected MyPermission(int mask) {
          super(mask);
       }
    
       protected MyPermission(int mask, char code) {
          super(mask, code);
       }
    }
    

    You need to register it with the permission factory to make it available in expressions; override the aclPermissionFactory bean in grails-app/conf/spring/resources.groovy, passing your class as the constructor argument:

    import org.springframework.security.acls.domain.DefaultPermissionFactory
    import com.mycompany.myapp.MyPermission
    
    beans = {
       aclPermissionFactory(DefaultPermissionFactory, MyPermission)
    }
    

    The reason it works unquoted with standard permissions is that MethodSecurityExpressionRoot has constants for the standard permissions:

    public final String read = "read";
    public final String write = "write";
    public final String create = "create";
    public final String delete = "delete";
    public final String admin = "administration";
    

    but there isn’t one for yours, so you need to quote it to force a lookup in your permission class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have integrated spring security plugin with my grails application, which has hibernate as
I learn Grails and Spring Security plugin. I don't know how to design sample
The Spring Security UI plugin, among other things, provides a registration page. On this
I use the spring-security-core plugin in my application. My user class extends SecUser and
I have a website which uses Spring Security. I have realized that when I
I am working on a project that involves Spring Security ACL and I came
I have installed spring-security-core in a grails project, but for some reason, IDEA didn't
I want to use Spring Security to manage user, group and permissions. I want
I'm trying to implement spring security acl into a project. After building the main
I'm trying to set up role-based Security with permissions. I'm trying to do this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.