Generalized selection function,
function check_permissions (permissions, uid, cb) { FB.Data .query('select {0} from permissions where uid={1}', permissions, uid) .wait(function (res) { if (!res || res.length < 1) return cb(false); var row = res[0]; var aperm = permissions.split(','); for (var i = 0; i < aperm.length; i++) { if (row[aperm[i]] != 1) return cb(false); } return cb(true); }); }
Calls a callback with true if the user has all permissions, otherwise it calls a callback with false.
tantalor Oct. 27 '11 at 18:35 2011-10-27 18:35
source share