views:

653

answers:

1

is there a way to check in my application (canvas) if the user has extended permission (for example "stream.publish")?

i only can find a solution for the old sdk.

thanks!

+3  A: 

found a solution myself

function check_ext_perm(session,callback) {
    var query = FB.Data.query('select publish_stream,read_stream from permissions where uid={0}', session["uid"]);
    query.wait(function(rows) {
        if(rows[0].publish_stream == 1 && rows[0].read_stream == 1) {
            callback(true);
        } else {
            callback(false);
        }
    });
};

this will check for publish_streamand read_stream

example use:

check_ext_perm(response.session, function(isworking) {
   if(isworking) {
      // post something to wall
   } else {
      // ask for login
   }
});
choise