Hi Dilshan
What I meant is the following
tenantDomain = userName.substring(userName.lastIndexOf('@') + 1);
Since we are sure that domain name cannot contain "@" taking lastIndexOf is
enough and safe rather than writing a regular expression to get the tenant
domain .. Is there any reason why you suggested regular expression?
On Wed, Apr 9, 2014 at 4:13 PM, Dilshan Edirisuriya <[email protected]>wrote:
> Although the lastIndexOf will work properly I suggest you add an regular
> expression so that it will work in any instance to get the domain name out
> of it.
>
>
> On Wed, Apr 9, 2014 at 3:55 PM, Amani Soysa <[email protected]> wrote:
>
>> Hi All,
>>
>> We are changing the current tenant model with a flat hierarchy in the
>> cloud, where we keep the email address as the user name.
>> In this model, the logged in user will be [email protected]@abc.com, where
>> my domain name will be abc.com and user name will be [email protected]
>>
>> This introduce couple of issues in app management app as in the app
>> management we assume that there will be only one "@" sign and we are
>> spiting from "@" sign to get the user name and domain separately.
>>
>> For example [1]
>>
>> var getAllAppsOfUser = function(userName){
>> // jagg.module("permission").checkUserAuthenticated();
>> try {
>> var result;
>> result = getAllApps(userName.split('@')[0]);
>>
>>
>>
>>
>> [1] -
>> https://svn.wso2.org/repos/wso2/scratch/appfactorycc/products/appfactory/1.1.0/modules/jaggery-apps/appmgt/src/modules/application/get/list.jag
>>
>> There are several places like this in app management, how should we
>> handle it? Is it possible to change the app_mgt code to break the user from
>> lastIndexOf('@') instead of using split? and also shall we introduce a new
>> module to get the userName and tenantDomain in a central location so we
>> don't have to do this same logic in several jaggery pages.
>>
>>
>> Regards,
>> Amani
>>
>> --
>> Amani Soysa
>> Senior Software Engineer
>> Mobile: +94772325528
>> WSO2, Inc. | http://wso2.com/
>> Lean . Enterprise . Middleware
>>
>> _______________________________________________
>> Architecture mailing list
>> [email protected]
>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>
>>
>
>
> --
> Dilshan Edirisuriya
> Senior Software Engineer - WSO2
> Mob: + 94 777878905
> http://wso2.com/
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>
--
Amani Soysa
Senior Software Engineer
Mobile: +94772325528
WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture