check_user_auth_linker.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. // This script is part of the Sloodle project
  3. /**
  4. * User object authorisation checker.
  5. * Allows objects to check that their user-centric authorisation works.
  6. * It will also make sure the avatar is registered.
  7. *
  8. * @package sloodle
  9. * @copyright Copyright (c) 2008 Sloodle (various contributors)
  10. * @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3
  11. *
  12. * @contributor Peter R. Bloomfield
  13. *
  14. */
  15. /*
  16. * The following parameters are required:
  17. *
  18. * sloodleuuid = UUID of the avatar
  19. * sloodlepwd = password to authenticate with
  20. *
  21. * If the authorisation is OK, the status code returned will be 1.
  22. */
  23. /** Lets Sloodle know we are in a linker script. */
  24. define('SLOODLE_LINKER_SCRIPT', true);
  25. /** Grab the Sloodle/Moodle configuration. */
  26. require_once('../init.php');
  27. /** Include the Sloodle PHP API. */
  28. require_once(SLOODLE_LIBROOT.'/sloodle_session.php');
  29. // Process the request and check the authorisation and avatar
  30. $sloodle = new SloodleSession();
  31. $sloodle->authenticate_user_request();
  32. $sloodle->validate_avatar();
  33. // Everything seems OK
  34. $sloodle->response->set_status_code(1);
  35. $sloodle->response->set_status_descriptor('OK');
  36. $sloodle->response->render_to_output();
  37. exit();
  38. ?>