grails-data-mapping
grails-data-mapping copied to clipboard
@CurrentTenant never affects app behavior
Task List
- [x] Steps to reproduce provided
- [x] Stacktrace (if present) provided
- [x] Example that reproduces the problem uploaded to Github
- [x] Full description of the issue provided (see below)
Steps to Reproduce
- Setup MT app
- Apply @WithoutTenant to a method in controller
- Apply @CurrentTenant to a method in a service
Expected Behaviour
Service method would execute with current tenant
Actual Behaviour
Without Tenant behavior in service annotated with CurrentTenant
Environment Information
- Operating System: OSX
- GORM Version: 6.1.10
- Grails Version (if using Grails): 3.3.6
- JDK Version: 8u161
Example Application
https://github.com/erichelgeson/mttests/blob/master/grails-app/controllers/mttests/CurrentController.groovy#L35
There are other scenarios in this controller as well - I cant find a senario where @CurrentTenant would cause the results to differ than just not including the annotation.
@erichelgeson Ideally, I would suggest moving the @WithoutTenant and @CurrentTenant to services. And, I think it should return books for a specific tenant once you remove @WithoutTenant from serviceWith action.