cancel
Showing results for 
Search instead for 
Did you mean: 

guest access in alfresco

flashboss
Champ in-the-making
Champ in-the-making
I would share how I allow guest access in Alfresco through webscript. Below there are the operations to execute:

- desc.xml files have to get <authentication>guest</authentication>

- All documents must to be in guest home of Alfresco or in a other folder with the same permissions of guest home

- The query for webscript inside get.js or post.js must to be something as: PATH:\"/app:company_home/app:guest_home/*\" using guest_home or other folder with the same permissions

- when we call a webscript we have to add 'guest=true' as parameter in webscript url. Here there is an example:

            YAHOO.util.Connect.asyncRequest(
               "GET", MySpaces.ServiceContext + '/my_url/my_webscript/results?'
               +'guest='+true
               +'&order='+form.ordinamento.value
               +'&text='+form.testo.value,
             {            })
5 REPLIES 5

_sax
Champ in-the-making
Champ in-the-making
Thanks a lot, still this didnt't work with our installation.

Following your instruction set, I received

"WebScript soandso requires user authentication; however, a guest has attempted access."

The only place where this message is to be found is in Alfresco source:
[…]
else if ((required == RequiredAuthentication.user || required == RequiredAuthentication.admin) && isGuest)
        {
            throw new WebScriptException(HttpServletResponse.SC_UNAUTHORIZED, "Web Script " + desc.getId() + " requires user authentication; however, a guest has attempted access.");
        }
[..,]

Why is this script insisting on its user authentification process?
The answer: via the xml-file the webscript is registered at startup.
Changes in it weren't of effect, as long as I didn't restart Alfresco.
Only ftl and js-files are being read everytime the webscript is called.

_sax
Champ in-the-making
Champ in-the-making
A last thing to note:
If companyhome or another folder variable is told to be undefined, it is because of user rights limitations set in your installation.
Companyhome and all subsequent folders to your folder thats displayed by your webscript have to have a read permission for the guest user.
Otherwise, they cannot be seen by him (rendering them undefined) and though by the script that acts in his context.

_sax
Champ in-the-making
Champ in-the-making
To reactivate this topic, I'm now trying to let no link to folders be displayed, that the guest user has no access to. Typically, they aren't listed by the script, though no problems evolve. But I'm giving a link for changing to the parent folder of the actual one.
As guest approaches a folder that its parent has not him as an invited user, the link (calling the script itself with the new noderef) is invalid and thus leads to a script error.
How can I check for undefined variables in Freemarker?
http://fmpp.sourceforge.net/freemarker/versions_2_1.html didn't really work.
Is it something like <#if Ordner.parent??==false> (looking very wrong)?

mikeh
Star Contributor
Star Contributor
In Freemarker, there are two ways to deal with undefined variables:

1 - <#if Ordner.parent??> Parent is: ${Ordner.parent} </#if>
2 - Parent is: ${Ordner.parent!"undefined"}

Thanks,
Mike

_sax
Champ in-the-making
Champ in-the-making
Thank you!

Did I understand this right?
<#if Ordner.parent??>display a link</#if>

At the top folder, this statement is fulfilled, it detects {http://www.alfresco.org/model/system/1.0}store_root, when checking for ${Ordner.parent!"undefined"}. Could this be filtered?