You are here

function fasttoggle_check_access in Fasttoggle 7

Carry out a series of access checks.

Parameters

array $checks: The list of checks to perform.

object $obj: The object being considered.

string $type: The type of object.

string $group: The setting group.

string $instance: The instance of the setting.

Return value

int The tristate result (ALLOWED / DENIED / UNDECIDED).

1 call to fasttoggle_check_access()
fasttoggle_get_allowed_links in ./fasttoggle.module
Get the list of links the current user may utilise.

File

./fasttoggle.module, line 340
Enables fast toggling of binary or not so binary settings.

Code

function fasttoggle_check_access(array $checks = array(), $obj = NULL, $type = NULL, $group = NULL, $instance = NULL) {
  foreach ($checks as $order => $check) {
    if (!function_exists($check)) {

      // Err on the side of caution, and say why.
      drupal_set_message("Fasttoggle access check function '{$check}' was not found. Denying access to the setting(s) affected.", 'error');
      return FASTTOGGLE_ACCESS_DENIED;
    }
    $result = $check($obj, $type, $group, $instance);
    if ($result != FASTTOGGLE_ACCESS_UNDECIDED) {
      return $result;
    }
  }
  return FASTTOGGLE_ACCESS_UNDECIDED;
}