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

Steve Swinsburg steve.swinsburg at gmail.com
Fri Jan 13 13:29:53 PST 2012


I think you are going to need to get the file in the same request as you add the security advisor. You can use the content hosting service to retrieve the file for you.

Cheers
Steve

Sent from my iPhone

On 14/01/2012, at 0:09, "Suparoek Leesaen" <sleesaen at samoo.es> wrote:

> 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
> 
> 
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> 
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"


More information about the sakai-dev mailing list