I have an array with permissions from Facebook and an array of the permissions that the user shouldve given:
window.FB.api('/me/permissions', function(perm){
if(perm){
var given_permissions = _.keys(perm['data'][0];
var needed_permissions = ["publish_stream", "email"];
//now check if given permissions contains needed permissions
}
}
Now I want to compare if all the needed_permissions
are in given_permissions
, in an underscore savvy way (without looping two arrays myself and compare values). I saw a _.include
method, but this compares an array with a value. I want to return true if all the permissions are available and else a false. I was looking for a nice single line call if possible.
The reason for this is, that FB.login
returns true even if the user chooses to cancel the extended permissions. So I need to doublecheck this.