cancel
Showing results for 
Search instead for 
Did you mean: 

Enable(give permission) guest to upload content

negi
Champ in-the-making
Champ in-the-making
Hello ,

How to enable guest to upload document.

case: suppose we have 2 different applications from one application we are
just giving the link from where anyone can upload link (link?q=key) of alfresco site.
so at the time of uploading we can validate the key of trusted source and upload the document.

so the basic thing is to give the permission to guest for create content(upload).


How to do this ,please suggest

Thanks in Adv
3 REPLIES 3

wgonzalez
Champ on-the-rise
Champ on-the-rise
Giving Guest access to upload files in the Repo is not a good practice, so you need to handle your internal validation carefully.
However, you can use the RESTful Login service (/alfresco/service/api/login?u={username}&pw={password?}) to establish a ticket as an Alfresco user.
After you get the authentication ticket, you can use that ticket to execute a javascript webservice that uploads the file.
Sample of such webscript can be found here: http://wiki.alfresco.com/wiki/Web_Scripts_Examples#File_Upload

Hope it helps.

pankajnegi
Champ in-the-making
Champ in-the-making
Thanks wgonzalez,

That's perfectly fine. I have tried this example

in File
upload.get.desc.xml

<webscript>
  <shortname>File Upload Form Sample</shortname>
  <description>Form for uploading file content and meta-data into Repository</description>
  <url>/sample/upload</url>
  <authentication>user</authentication>
</webscript>

And

File: upload.post.desc.xml

<webscript>
  <shortname>File Upload Sample</shortname>
  <description>Upload file content and meta-data into Repository</description>
  <url>/sample/upload</url>
  <authentication>user</authentication>
</webscript>


Get the ticket

http://localhost:8080/alfresco/service/api/login?u=admin&pw=admin

then use that form

http://localhost:8080/alfresco/service/sample/upload?alf_ticket=TICKET_a985d7ab7d9e101576a149a81d6e0...

and chose the file and press upload

at that time it ask me for the login authentication(login pop up comes)

so how to assign ticket for the post File: upload.post.desc.xml

Please


Thanks

scouil
Star Contributor
Star Contributor
I'm not sure it's a good idea to have the password hardcoded and sent out in the clear to get the ticket.

You should have a look at the "runas" property for webscripts as discussed in this topic it might better suit your needs:
https://forums.alfresco.com/en/viewtopic.php?f=36&t=43729