apache / apache/grails-core

aclUtilService.addPermission does not write to database

Open
#15,926 1 comment 0 reactions 0 assignees View on GitHub
relates-to:spring-security
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

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](https://github.com/grails-plugins/grails-spring-security-acl/files/2257508/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().

Contributor guide

Open the contributing guide

Research direction

Start with grails-app/services/grails/plugin/springsecurity/acl/AclService.groovy around createAcl() and its readAclById() call. Review the attached acl.stacktrace.txt and SQL log alongside aclUtilService.addPermission(), then determine why the expected saves produce no inserts. Done means the cause is identified and the ACL creation path persists the required records.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend, database, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.