You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Rahul Vangari <ra...@vnnogile.in> on 2019/04/17 05:57:41 UTC

Multi-tenancy issue when logging in second time

Hello all,

I'm working on multi-tenancy. But there is one major issue which is not 
letting me login once I logout. So, the scenario is suppose I have 2 
tenants tenant_1 and tenant_2. Now I login using tenant_1, perform 
transaction and then logout. Now when I again try to login using 
tenant_1 or tenant_2 I'm not able to login because when I query using 
delegator object to fetch the tenants from one of my entity I'm getting 
null which shouldn't be the case. But when I explicitly establish a 
database connection I'm able to login. So, my question is how do I make 
sure that delegator is used by the request when I login the second time?

-- 
Regards,
Rahul Vangari.
vnnogile Solutions Private Limited
www.vnnogile.com


Re: Multi-tenancy issue when logging in second time

Posted by Pierre Smits <pi...@apache.org>.
Hi,

Which version(s) were you using when trying to get the multi-tenancy aspect
going? I know (because I am using it myself for several demo setups) it has
been working with code from r14 and r15.

Best regards,

Pierre Smits

*Apache Trafodion <https://trafodion.apache.org>, Vice President*
*Apache Directory <https://directory.apache.org>, PMC Member*
Apache Incubator <https://incubator.apache.org>, committer
*Apache OFBiz <https://ofbiz.apache.org>, contributor (without privileges)
since 2008*
Apache Steve <https://steve.apache.org>, committer


On Wed, Apr 17, 2019 at 1:29 PM Mo <mo...@gmail.com> wrote:

> Hi,
>
> I had the same problem and modified the LoginWorker.Login method:
> // aim : always refresh delegator because sometime, tenantId in dispatcher
> is not the one in request attributes
> // hence commented below line
>             //if (delegatorNameHashIndex == -1 || (currentDelegatorTenantId
> != null && !tenantId.equals(currentDelegatorTenantId))) {
> And it works for me.
>
> Regards
>
> Mohammed
>
>
> Le mer. 17 avr. 2019 à 08:08, Rahul Vangari <ra...@vnnogile.in> a
> écrit :
>
> > Hello all,
> >
> > I'm working on multi-tenancy. But there is one major issue which is not
> > letting me login once I logout. So, the scenario is suppose I have 2
> > tenants tenant_1 and tenant_2. Now I login using tenant_1, perform
> > transaction and then logout. Now when I again try to login using
> > tenant_1 or tenant_2 I'm not able to login because when I query using
> > delegator object to fetch the tenants from one of my entity I'm getting
> > null which shouldn't be the case. But when I explicitly establish a
> > database connection I'm able to login. So, my question is how do I make
> > sure that delegator is used by the request when I login the second time?
> >
> > --
> > Regards,
> > Rahul Vangari.
> > vnnogile Solutions Private Limited
> > www.vnnogile.com
> >
> >
>

Re: Multi-tenancy issue when logging in second time

Posted by Mo <mo...@gmail.com>.
Hi,

I had the same problem and modified the LoginWorker.Login method:
// aim : always refresh delegator because sometime, tenantId in dispatcher
is not the one in request attributes
// hence commented below line
            //if (delegatorNameHashIndex == -1 || (currentDelegatorTenantId
!= null && !tenantId.equals(currentDelegatorTenantId))) {
And it works for me.

Regards

Mohammed


Le mer. 17 avr. 2019 à 08:08, Rahul Vangari <ra...@vnnogile.in> a
écrit :

> Hello all,
>
> I'm working on multi-tenancy. But there is one major issue which is not
> letting me login once I logout. So, the scenario is suppose I have 2
> tenants tenant_1 and tenant_2. Now I login using tenant_1, perform
> transaction and then logout. Now when I again try to login using
> tenant_1 or tenant_2 I'm not able to login because when I query using
> delegator object to fetch the tenants from one of my entity I'm getting
> null which shouldn't be the case. But when I explicitly establish a
> database connection I'm able to login. So, my question is how do I make
> sure that delegator is used by the request when I login the second time?
>
> --
> Regards,
> Rahul Vangari.
> vnnogile Solutions Private Limited
> www.vnnogile.com
>
>