iIdentifyUser.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace Luracast\Restler;
  3. /**
  4. * Interface to identify the user
  5. *
  6. * When the user is known we will be able to monitor, rate limit and do more
  7. *
  8. * @category Framework
  9. * @package restler
  10. * @author R.Arul Kumaran <arul@luracast.com>
  11. * @copyright 2010 Luracast
  12. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
  13. * @link http://luracast.com/products/restler/
  14. *
  15. */
  16. interface iIdentifyUser
  17. {
  18. /**
  19. * A way to uniquely identify the current api consumer
  20. *
  21. * When his user id is known it should be used otherwise ip address
  22. * can be used
  23. *
  24. * @param bool $includePlatform Should we consider user alone or should
  25. * consider the application/platform/device
  26. * as well for generating unique id
  27. *
  28. * @return string
  29. */
  30. public static function getUniqueIdentifier($includePlatform = false);
  31. /**
  32. * User identity to be used for caching purpose
  33. *
  34. * When the dynamic cache service places an object in the cache, it needs to
  35. * label it with a unique identifying string known as a cache ID. This
  36. * method gives that identifier
  37. *
  38. * @return string
  39. */
  40. public static function getCacheIdentifier();
  41. /**
  42. * Authentication classes should call this method
  43. *
  44. * @param string $id user id as identified by the authentication classes
  45. *
  46. * @return void
  47. */
  48. public static function setUniqueIdentifier($id);
  49. /**
  50. * User identity for caching purpose
  51. *
  52. * In a role based access control system this will be based on role
  53. *
  54. * @param $id
  55. *
  56. * @return void
  57. */
  58. public static function setCacheIdentifier($id);
  59. }