[Building Sakai] Finding a user's personal resources tool

Noah Botimer botimer at umich.edu
Tue Sep 28 08:30:22 PDT 2010


Eeek!

User sites are, by hard convention, "~userid", but you're better off using SiteService.getUserSiteId(userId). ContentHostingService.getSiteCollection(siteId) will give root collection ID for the site. Then you can get the collection the same way as any other: ContentHostingService.getCollection(collectionId).

Depending on the tool placement is bad mojo when you're in the JVM.

If you *really* need to work some magic, I've scraped the user ID and scripted the Resources tool through the browser with JS/background HTTP at runtime, but I do not recommend it since it is so brittle and kludgy.

Thanks,
-Noah


P.S. For the other problem described in this thread (landing the user on a well-known tool ID in a given site [or My Workspace]), I think the best general solution is to use the portal and DirectToolHandler. There is already handling for URLs like /portal/tool/sakai.resources?sakai.site=foo. Using /portal/directtool will launch the whole portal and activate the right page (i.e. translate to /portal/site/X/page/Y). The only problem is that this pipeline does not respond to a magic site reference (e.g. "~"), so generic things like URLs for "my profile tool" don't work in emails, etc.

Perhaps the cleanest overall solution is to extend DirectToolHandler as MyToolHandler, map the new /portal/mytool space (to avoid crytpic user-facing magic), look up user ID and funnel it through the super handling with the sakai.site parameter rewritten (or land at the top of My Workspace if not found, or possibly add a placement). This would take shape as something like /portal/mytool/sakai.profile2 -> /portal/directtool/sakai.profile2?sakai.site=~sswinsburg -> /portal/site/23fd-2f3sdf/page/ea3-a3-ff-af-3f, all as internal routing, so not bouncing the user through multiple requests.

I was going to implement exactly this a couple of years ago, but it must have slipped my mind.

On Sep 27, 2010, at 8:11 PM, Steve Swinsburg wrote:

> Hi Chris,
> 
> Get the user site for that user, then you can get the ToolConfiguration for a tool in that site.
> Profile2 does this to get the user's profile which is in the user's My Workspace.
> 
> https://source.sakaiproject.org/svn//profile2/trunk/impl/src/java/org/sakaiproject/profile2/logic/SakaiProxyImpl.java
> 
> See getDirectUrlToUserProfile and getFirstInstanceOfTool.
> 
> cheers,
> Steve
> 
> 
> 
> On 28/09/2010, at 10:01 AM, Dunstall, Christopher wrote:
> 
>> Hi all,
>>  
>> Can anyone tell me how I might be able to find a user’s own personal resources tool (which is in their My Workspace) in 2.4.x content hosting? I’m attempting to create a file for their eyes only and store it in content hosting, but I can’t seem to find the 2.4.x javadoc right now.
>>  
>> Regards,
>>  
>> Chris Dunstall | Service Support - Applications
>> Technology Integration/OLE Virtual Team
>> Division of Information Technology | Charles Sturt University | Bathurst, NSW
>>  
>> Ph: 02 63384818 | Fax: 02 63384181
>>  
>> _______________________________________________
>> 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"
> 
> _______________________________________________
> 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"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20100928/03f728be/attachment.html 


More information about the sakai-dev mailing list