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

Steve Swinsburg steve.swinsburg at gmail.com
Tue Sep 28 15:48:04 PDT 2010


Ok excellent. I think a general method (kernel perhaps) to get "my x tool" would be quite useful.

cheers,
Steve



On 29/09/2010, at 8:45 AM, Noah Botimer wrote:

> Oh, there's nothing strictly wrong with it. It's just that the same basic functionality is already pushed down to the portal. Another implementation on the edge is just another place that can't be used by others easily without duplication.
> 
> You've already written and tested it in place, and the API isn't volatile, so porting it is probably of low value. But if we're seeing needs for "my x tool" elsewhere, we should make that available more widely. 
> 
> Thanks,
> -Noah
> 
> On Sep 28, 2010, at 6:26 PM, Steve Swinsburg <steve.swinsburg at gmail.com> wrote:
> 
>> I missed out the CHS bit that Chris was after, the getSiteCollection, thanks Noah.
>> 
>> But what is the issue with the way the method fetches the URL to a tool in a site using Site.getToolForCommonId(toolId) and then getting the ToolConfiguration? It's been like this for close to two years without issue. Happy to change it if need be though.
>> 
>> cheers,
>> Steve
>> 
>> 
>> On 29/09/2010, at 1:30 AM, Noah Botimer wrote:
>> 
>>> 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/20100929/deb7703a/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3689 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20100929/deb7703a/attachment.bin 


More information about the sakai-dev mailing list