22 messages in com.googlegroups.opensocial-orkut[orkut-developer] Re: When would Apps...
FromSent OnAttachments
aravi13 Jun 2008 14:52 
ron14 Jun 2008 11:15 
Rohit Ghatol (Google)16 Jun 2008 01:24 
André Diniz16 Jun 2008 04:45 
Rajiv Renganathan16 Jun 2008 08:17 
André Diniz16 Jun 2008 08:56 
Gaurav Kushwaha16 Jun 2008 09:00 
André Diniz16 Jun 2008 09:05 
Jason18 Jun 2008 17:30 
André Diniz19 Jun 2008 09:27 
André Diniz19 Jun 2008 12:08 
André Diniz19 Jun 2008 12:10 
André Diniz20 Jun 2008 05:15 
Gaurav Kushwaha20 Jun 2008 05:19 
André Diniz20 Jun 2008 06:05 
Gaurav Kushwaha20 Jun 2008 08:36 
Jason23 Jun 2008 14:40 
André Diniz24 Jun 2008 04:37 
André Diniz24 Jun 2008 04:53 
Jason25 Jun 2008 10:20 
André Diniz25 Jun 2008 10:37 
Jason25 Jun 2008 16:00 
Subject:[orkut-developer] Re: When would Apps open up to rest of the users
From:Jason (apij@google.com)
Date:06/23/2008 02:40:06 PM
List:com.googlegroups.opensocial-orkut

Actually, no, you shouldn't be able to do this. The current user (i.e. VIEWER) should only be able to write to his own persistent data store, although he can access the data store of the OWNER and other users who have the application installed.

André, I realize your application was due last week, but could we return to your earlier problem? Your first snippet of code should have worked correctly -- once you update the VIEWER's data, you should be able to retrieve it directly. I wrote up a couple of functions in CodeRunner to verify this:

http://opensocial-resources.googlecode.com/svn/samples/coderunner/trunk/index.html

/* Update routine */ function update() { var req = opensocial.newDataRequest(); req.add(req.newUpdatePersonAppDataRequest("VIEWER", "poll_status", "C")); req.send(); };

/* Fetch routine */ function fetch() { var req = opensocial.newDataRequest();

var fields = new Array(); fields[0] = "poll_status";

req.add(req.newFetchPersonAppDataRequest("VIEWER", fields), "viewer_data"); req.add(req.newFetchPersonRequest("VIEWER"), "viewer"); req.send(fetchCallback); };

function fetchCallback(data) { var viewer = data.get('viewer').getData(); var appData = data.get('viewer_data').getData();

var viewerData = appData[viewer.getId()]; if (viewerData) { var viewerField = viewerData['poll_status']; if (viewerField) { output(viewerField); } } };

Please let me know if this doesn't work for you, and, if not, any errors you see.

On Jun 20, 8:37 am, "Gaurav Kushwaha" <gaur@gmail.com> wrote:

Yes, you can. Below code should do the job.

    var req = opensocial.newDataRequest();

req.add(req.newUpdatePersonAppDataRequest('OWNER',name,value),"owner_name_value");     req.send();

Gaurav

On Fri, Jun 20, 2008 at 6:36 PM, André Diniz <adi@gmail.com> wrote:

I figured out how to fix it! Right now, I'm doing:

/* Saving */ req.add(req.newUpdatePersonAppDataRequest("VIEWER", "poll_status", "C"));

/* Retrieving */ var fields = new Array(); fields[0] = "poll_status"; req.add(req.newFetchPersonAppDataRequest("OWNER", fields), "viewer_data");. . .

In fact, I just changed VIEWER to OWNER on retrieve.

Now I got other problem, as viewer user I'd like to save a field on owner app data, can I do that?

Thanks Gaurav!