You are here

function fb_node_grantsXXX in Drupal for Facebook 5

Same name and namespace in other branches
  1. 5.2 fb.module \fb_node_grantsXXX()

Implementation of hook_node_grants.

We put this here so all facebook modules have a standard way to implement hook_node_access_records. They use that hook to insert records into the node access table. We use this hook to allow access when the grants are there.

DEPRECATED. Not sure where, if anywhere, this belongs.

File

./fb.module, line 553

Code

function fb_node_grantsXXX($account, $op) {
  $grants = array();
  $fbu = fb_get_fbu($account);
  if ($fbu) {

    // If not anonymous (facebook user not logged in to this app)
    $friends = fb_get_friends($fbu);

    // For access purposes, consider a users to be a friend of themself
    $friends[] = $fbu;
    if (count($friends)) {
      $grants[FB_GRANT_REALM_FRIEND] = $friends;
    }
    $groups = fb_get_groups($fbu);
    if (count($groups)) {
      $grants[FB_GRANT_REALM_GROUP] = $groups;
    }
  }
  return $grants;
}