multi-tenant / grails-multi-tenant-single-db

Multi Tenant implementation for single database environments - Use grails-filtering and grails-hibernate-hijacker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tenancy Resolver being skipped

MaximumDamage opened this issue · comments

I discovered some strange behaviour.

In my system users can customize their layout obviously. For example they can add a custom logo into their system.

This works really well. I just call a service from within the layout (gsp) so that i dont have to pass tenant to model everytime.

Yet!
When my custom error page (404) is called the currentTenant results in null wich leads to terrible behaviour.

To reproduce this you would only have to use the default service load a MultiTenant object in your error gsp ( not in model ) and you will see the result of the page will always be the same. The content of your first tenant.

Is there a way to fix this. Were should I start looking?
I hope this is not a too distruptive post, I just really would like to help.
Also would be glad to research the error in master code my self.

Cheers
Max

I'd be happy to help if I can. Unfortunately I don't quite understand the issue. Is your custom error page using your main layout?

Since you are calling a service method from the GSP could you handle the possibility of a null tenant in the service?

What are you using to determine your tenant?

Hopefully some more info will help the team troubleshoot your issue.

Hello,

sorry for not getting back to you.

I use a custom tenant resolver and the tenant is resolved by the request subdomain.
The error page uses the main layout, that is correct.

I could handle the case of null in my service, yet I would like to display some tenant
info on the error page, like a custom logo.

My current workaround is to redirect to error pages or let them be handled by tomcat ( uncaught / ugly 404 )
It seems that in some cases I cannot get the tenant when a 404 appears. In other cases where I handel it via redirect or i throw it the 404 works fine.