[Building Sakai] Is there a way to get the username?
Noah Botimer
botimer at umich.edu
Tue Jan 14 07:52:07 PST 2014
So, you're looking for a link that a learner would click to go to an external, personalized URL?
There are a couple of ways to manage this...
1. Implement the IMS LTI spec on the external system so it is a Tool Provider -- this is the most complete and secure way, but obviously more involved
2. Implement a quick Servlet / EntityProvider to look up the current user and issue a redirect with the appropriate destination -- the links would be back to the Sakai instance (and be static, not including username)
Depending on how user-friendly you need this to be, it may involve an addition to Lessons or a CKEditor plugin.
Another hackish angle is that you can use the existing EntityProviders to get current user information via AJAX and rewrite the link or update window.location -- this would require some scripting mojo.
Thanks,
-Noah
On Jan 14, 2014, at 10:18 AM, Paul Dagnall wrote:
> Adrian - Is the UserDirectoryService exposed to the content area editable by the ckeditor though? My goal is for content creators to be able to make lessonbuilder content that would include such a link.
>
> Paul Dagnall
> Application Developer & Administrator
> University of Dayton
>
>
> On Tue, Jan 14, 2014 at 10:01 AM, Adrian Fish <adrian.r.fish at gmail.com> wrote:
> Hi Paul,
>
> So, you're rendering a link in a lessonbuilder page, and you want to embed the current user's name in it? In that case, just use UserDirectoryService.getCurrentUser, which will get you a Sakai User object. You can then call getFirstName, getLastName and getEid on that object.
>
> If you have a look in ShowPageProducer, you'll see examples of that method in use.
>
> Cheers,
> Adrian.
>
>
> On 14 January 2014 14:51, Paul Dagnall <pdagnall1 at udayton.edu> wrote:
> Hi
> Does anyone know of a way to get the current user's username and expose it so it can be accessed by that user from a sakai content page?
>
> There is an external system we are trying to access from a html link in the Lessons tool. Basically we'd like the link to be something like this:
>
> http://externalSystem.edu/program.php?userName=<current user name>&otherParam=value
>
> I know there's a webservice that will get me the user name if I have the session id, which I don't think is available in that scope.
>
> Thanks!
>
> Paul Dagnall
> Application Developer & Administrator
> University of Dayton
>
>
> _______________________________________________
> 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/20140114/b819776b/attachment.html
More information about the sakai-dev
mailing list