[Building Sakai] Is there a way to get the username?

Adrian Fish adrian.r.fish at gmail.com
Tue Jan 14 07:01:13 PST 2014


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"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20140114/4a8d1872/attachment.html 


More information about the sakai-dev mailing list