You are here

function _fac_get_role_hmac in Fast Autocomplete 7

Gets a HMAC based on account roles.

Parameters

object $account: User account object.

Return value

string A HMAC signed with the site-specific secret key.

2 calls to _fac_get_role_hmac()
fac_generate_json_for_key in ./fac.module
Generates the json file for a specific search key.
fac_page_build in ./fac.module
Implements hook_page_build().

File

./fac.module, line 555
This file contains the main functions of the Fast Autocomplete module.

Code

function _fac_get_role_hmac($account) {
  $rids = array_keys($account->roles);
  sort($rids);

  // Prevent user 1 accounts without the administrator role leaking information
  // via DRUPAL_AUTHENTICATED_RID.
  if ($account->uid == 1) {
    $rids[] = -1;
  }
  return drupal_hmac_base64('fac-' . implode('|', $rids), _fac_get_hmac_key());
}