grails-spring-security-acl icon indicating copy to clipboard operation
grails-spring-security-acl copied to clipboard

aclUtilService.addPermission does not write to database

Open jasenj1 opened this issue 7 years ago • 1 comments

I have an app with a bunch of existing domain objects/records I'm trying to add ACL to.

I created a method that grants permissions. Within the method is a catch block for NotFoundException which calls aclUtilService.addPermission().

From the best I trace out acl.stacktrace.txt , addPermission should call aclService.createAcl(oid) which should create the object identity and on down the stack to eventually .save()ing all the necessary objects.

But it doesn't.

When running my app with logSql turned on, I see a lot of selects, but no inserts. At the end of AclService.createAcl() (https://github.com/grails-plugins/grails-spring-security-acl/blob/master/plugin/grails-app/services/grails/plugin/springsecurity/acl/AclService.groovy#L84) is a call to readAclById(). This fails with a NotFoundException.

I see where the .save()s are done there is some error logging, but I don't see those log messages.

Is the Hibernate session not being flushed? Some other configuration switch I'm forgetting? FWIW, I'm using Oracle 12c as my database.

Attached is the SQL log & stack trace. The "About to create... " line is printed just before the call to aclUtilService.addPermission().

jasenj1 avatar Aug 03 '18 13:08 jasenj1

FWIW, I subclassed AclService and created a method that does not do the final readAclById(). It works fine.

jasenj1 avatar Aug 03 '18 17:08 jasenj1