You are here

function zoomapi_webhooks_access in Zoom API 7

Same name and namespace in other branches
  1. 7.2 zoomapi.module \zoomapi_webhooks_access()

Access callback: Zoom API Webhooks.

1 string reference to 'zoomapi_webhooks_access'
zoomapi_menu in ./zoomapi.module
Implements hook_menu().

File

./zoomapi.module, line 63
Main file for the Zoom API module.

Code

function zoomapi_webhooks_access() {

  // Only allow POST requests.
  $http_verb = strtoupper($_SERVER['REQUEST_METHOD']);
  if ($http_verb != 'POST') {
    return FALSE;
  }

  // Webhooks not enabled.
  if (!variable_get('zoomapi_webhooks_enabled', FALSE)) {
    return FALSE;
  }

  // Validate basic auth.
  if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW']) && $_SERVER['PHP_AUTH_USER'] == variable_get('zoomapi_webhooks_username', FALSE) && $_SERVER['PHP_AUTH_PW'] == variable_get('zoomapi_webhooks_password', FALSE)) {
    return TRUE;
  }
  return FALSE;
}