cancel
Showing results for 
Search instead for 
Did you mean: 

Execute webscript on user login

iwkse
Star Contributor
Star Contributor
Hi,
I'm new with Alfresco and RESTful API, I have to set a cookie that has to contain the userid.
I was trying to do that from yui, registering another component and, the Cookie.set works fine
but it seems I cannot access to any of the JS object of Alfresco, so there's no way within there
to retrieve the userid.
Now I'm valuing to change the approach and create a webscript where I can use the YUI library to
set that cookie.
The only doubt I have is about..how do I execute such webscript at user login? Or more generic, how
to automatically run the webscript so that I can check if the user is defined (if there's a login) and set the cookie
otherwise leave it.

I hope someone can give me a hint,

kind regards,
Salvatore
4 REPLIES 4

mitpatoliya
Star Collaborator
Star Collaborator
alfresco javascript objects are context sensitive means It always depend on the context in which you are executing the script with different context different objects are available.
Also, for checking the user you need to use alfresco services and for accessing those services you must authenticate first with the alfresco by creating the session. So, that's kind of tricky part

zladuric
Champ on-the-rise
Champ on-the-rise
If I understand correctly, you want to access userid?

In Share?

You can do that simply by calling Alfresco.constants.USERNAME. Alfresco.constants object is pretty cool, lots of good stuff there. Take a look at some other useful client-side YUI/Alfresco stuff here:
http://sharextras.org/jsdoc/share/community-4.0.d/index.html

iwkse
Star Contributor
Star Contributor
Hi,
yes in share. Actually I found that out about costants, but after I was going to extend that to other profile's fields. I'd like to list something else that is possible to get from person.properties.
Which is the context where the object person is defined?

regards,
Salvatore

zladuric
Champ on-the-rise
Champ on-the-rise
Hmm, I'm not sure about that. I think I saw something of it in backend (repo). Something called metadata.get.js?