Hi Dimuthu,

Search for usages of  MultitenantConstants.SUPER_TENANT_DOMAIN_NAME in
Registry Kernel, and you'll find all of it. In some places its

tenantDomain != null &&
!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)

My feeling is that the fixes done here are not correct.

Thanks,
Senaka.

On Thu, Jun 7, 2012 at 11:50 PM, Dimuthu Leelarathne <[email protected]>wrote:

> Hi Senaka,
>
> I only saw this in RegistryResolver.java. The general solution would be as
> follows. But there can be exceptions.
>
>
> - if (tenantDomain == null)
> +if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) {
> +//do super tenant something
> +} else if (teanantDomain == null) {
> +//do something - prolly throw exception
> +}
>
> However the opposite should be treated as follows. I think we correctly
> handle this.
> - if (tenantDomain != null)
> +if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) {
> +//do none super tenant thing
> +}
>
>
> Would this solve the situation?
>
> thanks,
> dimuthu
>
>
> On Thu, Jun 7, 2012 at 11:20 PM, Senaka Fernando <[email protected]> wrote:
>
>> Hi Chethiya,
>>
>> There are several such places in the Registry Kernel. This is just one.
>> We need a proper solution to this. How can someone know whether to check
>> for null and decide whether it is super tenant or
>> MultitenantConstants.SUPER_TENANT_DOMAIN_NAME and decide whether it is
>> super tenant? If we go along that path, it will be error prone and it'll be
>> worse than what we had before.
>>
>> Thanks,
>> Senaka.
>>
>>
>> On Thu, Jun 7, 2012 at 11:13 PM, Chethiya Abeysinghe 
>> <[email protected]>wrote:
>>
>>> This is
>>> in 
>>> ./org.wso2.carbon.registry.core/src/main/java/org/wso2/carbon/registry/app/RegistryResolver.java
>>> and was a fix in recent hackathon. And this is the diff:
>>>
>>> -                        if (tenantDomain == null) {
>>> +                        if (tenantDomain == null ||
>>> +                         
>>> MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain))
>>> {
>>>
>>> It was a simple quick replace of the old logic using current mapping of
>>> *tenantDomain* constants.
>>>
>>> It's better to remove "||  
>>> MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain"
>>> part I guess.
>>>
>>> In fact do we need to proceed with the normal execution when there is no
>>> tenantDomain in the servlet request? i.e. is it safe to try figure out the
>>> domain name from username.
>>>
>>> In case it's fine, there are two old bugs need to be fixed in
>>> "getUserName()" and "getTenantId()".
>>>
>>>  - Chethiya
>>>
>>>
>>>> Going through the code in Registry Kernel I discovered that you have
>>>> made changes to determine whether you are super tenant as follows:
>>>>
>>>> tenantDomain == null ||
>>>> MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)
>>>>
>>>> Is this correct? Why are we checking for null or some constant?
>>>>
>>>> Thanks,
>>>> Senaka.
>>>>
>>>> --
>>>> *Senaka Fernando*
>>>> Member - Integration Technologies Management Committee;
>>>> Technical Lead; WSO2 Inc.; http://wso2.com*
>>>> Member; Apache Software Foundation; http://apache.org
>>>>
>>>> E-mail: senaka AT wso2.com
>>>> **P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
>>>> Linked-In: http://linkedin.com/in/senakafernando
>>>>
>>>> *Lean . Enterprise . Middleware
>>>>
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> [email protected]
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Chethiya Abeysinghe
>>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>>> email: [email protected]     phone: +94 777444891
>>> blog: chethiya3000.blogspot.com
>>>
>>>
>>>
>>
>>
>> --
>> *Senaka Fernando*
>> Member - Integration Technologies Management Committee;
>> Technical Lead; WSO2 Inc.; http://wso2.com*
>> Member; Apache Software Foundation; http://apache.org
>>
>> E-mail: senaka AT wso2.com
>> **P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
>> Linked-In: http://linkedin.com/in/senakafernando
>>
>> *Lean . Enterprise . Middleware
>>
>>
>
>
> --
> Dimuthu Leelarathne
> Architect & Co-Chair of Platform Management Committee
>
> WSO2, Inc. (http://wso2.com)
> email: [email protected]
>
>
> Lean . Enterprise . Middleware
>
>


-- 
*Senaka Fernando*
Member - Integration Technologies Management Committee;
Technical Lead; WSO2 Inc.; http://wso2.com*
Member; Apache Software Foundation; http://apache.org

E-mail: senaka AT wso2.com
**P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
Linked-In: http://linkedin.com/in/senakafernando

*Lean . Enterprise . Middleware
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to