Hi Lakshan,

TenantMgtUtil. validateDomain method check the domain name has correct
format and not checking weather tenant domain really exist in the system.
And -1 is using for invalid tenant id and -1234 use for super tenant id.


Thanks
Godwin



On Fri, Dec 19, 2014 at 10:08 AM, Lakshman Udayakantha <[email protected]>
wrote:
>
> Hi Prasanna,
>
> org.wso2.carbon.tenant.mgt.util.TenantMgtUtil class have validateDomain
> method to validate Tenant domain. can't you use that? AFAIR -1 tenant id
> associate with super tenant, for other tenants it becomes another value. So
> using tenant id to validate domain is not a good way as I think.
>
> Thanks
>
> On Fri, Dec 19, 2014 at 9:55 AM, Prasanna Dangalla <[email protected]>
> wrote:
>>
>> Hi
>>
>> I need to check whether a specific tenant domain is a valid one or not.
>> If its an invalid domain when getting the tenant id by giving the domain it
>> retains a -1. So is it the correct way to check whether the tenant domain
>> is valid of not as below by checking with -1 in the code.
>>
>> int tenantId = 
>> ServiceHolder.getRealmService().getTenantManager().getTenantId(tenantDomain);
>>
>> if(tenantId != -1) {
>>
>>      //Do the operation
>>
>> } else {
>>
>>      //Invalid tenant
>>
>> }
>>
>>
>> Thanks
>> --
>> Prasanna Dangalla
>> Software Engineer, WSO2, Inc.; http://wso2.com/
>> lean.enterprise.middleware
>>
>> cell: +94 777 55 80 30 | +94 718 11 27 51
>> twitter: @prasa77
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
> --
> Lakshman Udayakantha
> WSO2 Inc. www.wso2.com
> lean.enterprise.middleware
> Mobile: *0711241005*
>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>

-- 
*Godwin Amila Shrimal*
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: *+94772264165*
linkedin: *http://lnkd.in/KUum6D <http://lnkd.in/KUum6D>*
twitter: https://twitter.com/godwinamila
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to