You are here

function pmperson_update_access_allowed in Drupal PM (Project Management) 7.2

Same name and namespace in other branches
  1. 8 pmperson/pmperson.module \pmperson_update_access_allowed()
  2. 7.3 pmperson/pmperson.module \pmperson_update_access_allowed()

Access check for resolving conflicts.

See also

update_access_allowed()

1 string reference to 'pmperson_update_access_allowed'
pmperson_menu in pmperson/pmperson.module
Implements hook_menu().

File

pmperson/pmperson.module, line 28
Hook implementations for the pmperson module.

Code

function pmperson_update_access_allowed() {
  global $update_free_access, $user;

  // Allow the global variable in settings.php to override the access check.
  if (!empty($update_free_access)) {
    return TRUE;
  }

  // Calls to user_access() might fail during the Drupal 6 to 7 update process,
  // so we fall back on requiring that the user be logged in as user #1.
  try {
    require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'user') . '/user.module';
    return user_access('administer software updates');
  } catch (Exception $e) {
    return $user->uid == 1;
  }
}