You are here

function log_add_access in Log entity 7

Access callback: Checks whether the user has permission to add a log.

Parameters

object|null $account: Optionally, a user account to check access for.

Return value

bool Returns TRUE if the user has add permission, otherwise FALSE.

1 string reference to 'log_add_access'
log_menu in ./log.module
Implements hook_menu().

File

./log.module, line 845
Log - A general purpose record keeping system.

Code

function log_add_access($account = NULL) {

  // If no user object is supplied, the access check is for the current user.
  if (empty($account)) {
    global $user;
    $account = $user;
  }

  // Check each of the log types to see if the user has access.
  $types = log_types();
  foreach ($types as $type) {
    if (log_access('create', $type->type, $account)) {
      return TRUE;
    }
  }

  // If all else fails, deny access.
  return FALSE;
}