Hi Swapnil. Excellent point -- the current user has to install the app
before it can store data associated with that user. So yes, if the
VIEWER object returned is non-null (indicating the current user has
the app), then you can safely call newUpdatePersonAppDataRequest. You
shouldn't otherwise.

- Jason

On Oct 14, 2:50 pm, "Swapnil Shinde" <[EMAIL PROTECTED]> wrote:
> Jason,
> Can the app write to the VIEWER's data store even if the viewer has not
> installed the app? If the viewer object is not null does that mean we can
> safely write to the VIEWER's data store?
>
> Thanks,
> Swapnil.
>
> On Tue, Oct 14, 2008 at 2:27 PM, Jason <[EMAIL PROTECTED]> wrote:
>
> > Your syntax is correct, but orkut does not allow applications to write
> > to any other user's app data other than that of the current user. This
> > prevents me from overwriting another user's data and with potentially
> > malicious content. Your app should still be able to fetch OWNER data,
> > but you will only be able to write to the VIEWER's data store.
>
> > - Jason
>
> > On Oct 14, 3:29 am, hwked <[EMAIL PROTECTED]> wrote:
> > > Just to add. Data retrieval using "
>
> > req.add(req.newFetchPersonAppDataRequest("OWNER",'twitterid'),'userdata');
> > > " works fine.
>
> > > The problem occurs in "
> > > req.add(req.newUpdatePersonAppDataRequest("OWNER",'twitterid',twit_id));
> > > "
>
> > > However, if I replace OWNER with VIEWER in the above statement, it
> > > works fine. i.e.
>
> > > "
> > > req.add(req.newUpdatePersonAppDataRequest("VIEWER",'twitterid',twit_id));
> > > " works fine.
>
> > > What am I doing wrong?
>
> > > On Oct 14, 3:19 pm, hwked <[EMAIL PROTECTED]> wrote:
>
> > > > Ah I just tried this, and it worked out.
>
> > > > If I replace "OWNER" with "VIEWER" everywhere, it works out. Why isn't
> > > > it working for OWNER ??
>
> > > > On Oct 14, 9:05 am, hwked <[EMAIL PROTECTED]> wrote:
>
> > > > > It doesn't seem to be working for me. Neither at sandbox.orkut.comnor
> > > > > at prod.sandbox.orkut.com . I already tried clearing my browser
> > cache
>
> > > > > here is the relevant piece of code:
>
> > > > > function storeSettings()
> > > > > {
> > > > >         var req = opensocial.newDataRequest();
> > > > >         var twit_id = "ahujaankit";
>
> > req.add(req.newUpdatePersonAppDataRequest("OWNER",'twitterid',twit_id));
> > > > >         req.send(onStoreSettings);
>
> > > > > }
>
> > > > > function onStoreSettings(data)
> > > > > {
> > > > >         if(data.hadError())
> > > > >         {
> > > > >            alert("Data Couldn't be Stored!");
> > > > >         }
> > > > >         else
> > > > >         {
> > > > >            alert("Data Stored!");
> > > > >         }
>
> > > > > }
>
> > > > > function loadSettings()
> > > > > {
> > > > >         var req = opensocial.newDataRequest();
> > > > >         req.add(req.newFetchPersonRequest("OWNER"),'owner');
>
> > req.add(req.newFetchPersonAppDataRequest("OWNER",'twitterid'),'userdata');
> > > > >         req.send(onLoadSettings);
>
> > > > > }
>
> > > > > function onLoadSettings(data)
> > > > > {
> > > > >         var owner = data.get('owner').getData();
> > > > >         var owner_id = owner.getId();
> > > > >         var userdata = data.get('userdata').getData();
> > > > >         var twitid = null;
> > > > >         if(userdata[owner.getId()])
> > > > >         {
> > > > >                 var twitid = userdata[owner.getId()]['twitterid'];
> > > > >         }
>
> > > > >         if(twitid)
> > > > >         {
> > > > >                 twitter_id = twitid;
> > > > >                 getTweets();
> > > > >         }
> > > > >         else
> > > > >         {
> > > > >                 makeSettings();
> > > > >         }
>
> > > > > }
>
> > > > > Unfortunately, Data Couldn't be Stored is always displayed.
> > > > > Do you see anything wrong with this code? Please reply soon as I am
> > > > > stuck on this.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Orkut Developer Forum" group.
To post to this group, send email to opensocial-orkut@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to