You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rave.apache.org by "Noe-Payne, Erin A." <er...@mitre.org> on 2012/08/06 20:45:46 UTC

Getting page owner and viewer

Hi All,

I have a simple question that I'm struggling with. In javascript from the container context - not from within a gadget - how can I get the page viewer and owner objects? Any help is appreciated!

Thanks,
Erin

RE: Getting page owner and viewer

Posted by "Carlucci, Tony" <ac...@mitre.org>.
>-----Original Message-----
>From: Noe-Payne, Erin A. [mailto:erinnp@mitre.org]
>Sent: Monday, August 06, 2012 2:46 PM
>To: dev@rave.apache.org
>Subject: Getting page owner and viewer
>
>Hi All,
>
>I have a simple question that I'm struggling with. In javascript from the container
>context - not from within a gadget - how can I get the page viewer and owner
>objects? Any help is appreciated!
>
>Thanks,
>Erin

Hi Erin,

The concept of the "viewer" in the container context would be the current authenticated user.  We currently have access to the authenticated user in the JSP layer using the spring security tags, for example: <sec:authentication property="principal.username" var="username" scope="request"/>

If you need to access this data via Javascript I suggest modifying the rave_js.tag file to add a new function that stores the username, userId, etc dynamically.  Note the existing block that sets the current dynamic web context into our javascript:

<script>
    rave.setContext("<spring:url value="/app/" />");
</script>

You could do something very similar, like rave.setCurrentViewerId(<sec:authentication property="principal.id" scope="request"/>) or something along those lines.

As for the concept of "owner", I think at the container level, "owner" is going to be different depending on what portal page you are looking at.  For example the owner of the person profile page is probably the person you are looking at.  However, who is the owner of the widget store page?  There may not be one.   So you might have to build in custom business logic for the concept of "owner" depending on which Rave application page you are currently looking at.

Hope that helps, 
Tony