Hi Sameera,

On Jul 20, 2015 9:32 PM, "Sameera Medagammaddegedara" <[email protected]>
wrote:
>
> Hi Lakshman,
>
>
> Could we not do this in the onUserLoggedIn callback itself after checking
if the logged in user already has the subscriber role or not?

We can't use this approach,because then for any user tries to login to
store,we are setting the subscriber role,which is incorrect..
What we want is setting the subscriber role for store sign-up users.Isn't
there a sign-up hook available as for login..?

Thanks:
>
>
> Thank You,
> Sameera
>
> On Mon, Jul 20, 2015 at 6:10 AM, Lakshman Udayakantha <[email protected]>
wrote:
>>
>> Couldn't add onLogin function is used in extension in previous mail.
sorry for that. find it below.
>>
>> onUserLoggedIn : function(){
>>             var userName=ctx.username;
>>             var apistore =
require('apistore').apistore.instance(userName);
>>             var subscriber=apistore.getSubscriber(userName);
>>             if(!subscriber){
>>                 apistore.addSubscriber(userName,ctx.tenantId);
>>             }
>>         },
>>
>> additionally, found below function
>>
>>  event.on('userRegister', function (tenantId, user) {
>>         log.info("user registering...................................");
>>         configs(tenantId).userRoles.forEach(function (role) {
>>             if (user.hasRoles([role])) {
>>                 return;
>>             }
>>             user.addRoles([role]);
>>         });
>>     });
>>
>> It should be call on user signup. But it calls on first login for the
users who signed up. Any way I can't change that function to add subscriber
role to users because this function found in store/module/store.js file
which is not in extension directory. simply this function reside in ES code
and adding subscriber role to users should happen in extension because that
functionality is specific to API store.
>>
>> Thanks
>>
>> On Mon, Jul 20, 2015 at 3:05 PM, Lakshman Udayakantha <[email protected]>
wrote:
>>>
>>> Hi Sameera/ES Team,
>>>
>>> I am working on [1]. I want to add to users who sign up in store, the
subscriber role.
>>> Below function is used to add users as subscribers in their first login
to subscriber tables in asset.js function in store extension. similar
requirement needs for signup as well. how do I achieve this?
>>>
>>> [1] https://wso2.org/jira/browse/REGISTRY-2683
>>>
>>> Thanks
>>> --
>>> Lakshman Udayakantha
>>> WSO2 Inc. www.wso2.com
>>> lean.enterprise.middleware
>>> Mobile: 0711241005
>>>
>>
>>
>>
>> --
>> Lakshman Udayakantha
>> WSO2 Inc. www.wso2.com
>> lean.enterprise.middleware
>> Mobile: 0711241005
>>
>
>
>
> --
> Sameera Medagammaddegedara
> Software Engineer
>
> Contact:
> Email: [email protected]
> Mobile: + 94 077 255 3005
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to