[Building Sakai] Getting a permission to download the resources from the site which the user does not belong to

Suparoek Leesaen sleesaen at samoo.es
Fri Jan 13 05:09:56 PST 2012


Dear all,

I'm currently developing a tool which a special user needs to be able to
access the resources from other users's personal resources. I was able to
retrieve the url of the particular resource but when I tried to redirect
the user to that url, I was notified "Access to the specified resource ()
has been forbidden".

This is basically my code for downloading the resources:

    final String fileUrl = getFileUrl();

		Link downloadFileLink = new Link("downloadFile")
        {
            @Override
            public void onClick()
            {
            	securityService.pushAdvisor(new SecurityAdvisor()
        		{
        			public SecurityAdvice isAllowed(String userId, String function,
String reference)
        			{
        				return SecurityAdvice.ALLOWED;
        			}

        		});
            	 getRequestCycle().setRequestTarget(new
RedirectRequestTarget(fileUrl));
            	 securityService.popAdvisor();
            }
        };

As you may be able to see, I activated pushAdvisor before redirecting to
the download page. I also checked with contentHosting#allowGetResource and
I got the expected boolean values. What have I done wrong here?


Thanks in advance

Suparoek Leesaen




More information about the sakai-dev mailing list