cancel
Showing results for 
Search instead for 
Did you mean: 

WebScripts authorization & design

alrice
Champ in-the-making
Champ in-the-making
I am using the WebScripts feature in 2.1 and I am finding it's very nicely designed and easy to understand. I am implementing some public application forms and survey forms. The responses will get saved into Alfresco into a Drop Zone kind of space. However these are public forms and I would prefer not to bother the visitors to login as guest. If i set the WebScripts to use authentication none, then the roothome and companyhome objects are not available, and thus it's not possible to get a node reference for uploading content into Alfresco. What is recommended? Seems to me the choices are:

a) Automatically sign the user on as guest : guest and run the webscript authentication as guest . and if so, how is that done to automatically sign the visitor on? Maybe there is a client side trick with javascript that can be done if there is nothing on the Alf side to do  it?
b) Run the webscript as authentication none in which case I believe it's impossible to save content to the cms, correct?

Thanks for any advice you are able to provide on this design question.
Alex Rice
alexr@santafe.edu
4 REPLIES 4

davidc
Star Contributor
Star Contributor
Set <authentication>guest</authenticaton> in your public web script *.desc.xml files.

Then, when invoking a web script url, add the guest=true url argument.

All items within the repository that need to be read or updated must have guest permissions assigned.

<authentication>none</authentication> means the web script cannot do anything with the repository that requires user authentication.  It's useful when rendering non-repository data backed responses.

alrice
Champ in-the-making
Champ in-the-making
David, thank you very much. I see now. The guest=true works. Question- it doesn't seem to work with POSTs, just GETs. However, I am cheating and put it on the ACTION as a url argument like this. Is this cheating? will it work with most browsers do you think?

<form action="${url.service}?guest=true"
   method="post"
   enctype="multipart/form-data" id="form1"
   charset="utf-8">


Thanks again
Alex Rice

workingpeter
Champ in-the-making
Champ in-the-making
Accessing roothome as guest does not appear to be working under 2.9 Labs version. Requesting a script as guest that uses roothome results in error message "roothome is not defined".

The same script does work under Community version 2.1.0.

davidc
Star Contributor
Star Contributor
Ok, we'll take a look. Thanks.