grails-data-mapping icon indicating copy to clipboard operation
grails-data-mapping copied to clipboard

@CurrentTenant never affects app behavior

Open erichelgeson opened this issue 7 years ago • 1 comments

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

  1. Setup MT app
  2. Apply @WithoutTenant to a method in controller
  3. 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 avatar Jul 20 '18 15:07 erichelgeson

@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.

puneetbehl avatar Apr 24 '19 07:04 puneetbehl