You are here

function services_auth_invoke in Services 6.3

Same name and namespace in other branches
  1. 6.2 services.module \services_auth_invoke()
  2. 7.3 includes/services.runtime.inc \services_auth_invoke()
  3. 7 services.module \services_auth_invoke()

Invokes a authentication module callback.

Parameters

string $module: The authentication module to invoke the callback for.

string $method: The callback to invoke.

string $arg1: Optional. First argument to pass to the callback.

string $arg2: Optional. Second argument to pass to the callback.

string $arg3: Optional. Third argument to pass to the callback.

string $arg4: Optional. Fourth argument to pass to the callback.

Return value

mixed

Aren't these really the following? arg1 = Settings arg2 = Method arg3 = Controller arg4 = Auth args

4 calls to services_auth_invoke()
services_controller_execute in ./services.runtime.inc
Performs access checks and executes a services controller. This method is called by server implementations.
services_edit_form_endpoint_authentication in plugins/export_ui/services_ctools_export_ui.class.php
Endpoint authentication configuration form.
services_edit_form_endpoint_resources in plugins/export_ui/services_ctools_export_ui.class.php
services_edit_form_endpoint_resources function.
_services_build_resources in ./services.resource_build.inc
Builds the resource definition array for a endpoint.

File

./services.runtime.inc, line 223
Contains functions that only are necessary when a service call is made. This has broken out so that this code isn't loaded for every page load.

Code

function services_auth_invoke($module, $method, &$arg1 = NULL, &$arg2 = NULL, &$arg3 = NULL, $arg4 = NULL) {

  // Get information about the auth module
  $info = services_authentication_info($module);
  $func = $info && !empty($info[$method]) ? $info[$method] : FALSE;
  if ($func) {
    if (!empty($info['file'])) {
      require_once drupal_get_path('module', $module) . '/' . $info['file'];
    }
    if (is_callable($func)) {
      $args = func_get_args();

      // Replace module and method name and arg1 with reference to $arg1 and $arg2.
      array_splice($args, 0, 5, array(
        &$arg1,
        &$arg2,
        &$arg3,
        &$arg4,
      ));
      return call_user_func_array($func, $args);
    }
  }
  else {
    return TRUE;
  }
}