iusersession.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Bart Visscher
  6. * @author Bernhard Posselt
  7. * @copyright 2013 Bart Visscher bartv@thisnet.nl
  8. * @copyright 2014 Bernhard Posselt <dev@bernhard-posselt.com>
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  12. * License as published by the Free Software Foundation; either
  13. * version 3 of the License, or any later version.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public
  21. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. /**
  25. * Public interface of ownCloud for apps to use.
  26. * User session interface
  27. *
  28. */
  29. // use OCP namespace for all classes that are considered public.
  30. // This means that they should be used by apps instead of the internal ownCloud classes
  31. namespace OCP;
  32. /**
  33. * User session
  34. */
  35. interface IUserSession {
  36. /**
  37. * Do a user login
  38. * @param string $user the username
  39. * @param string $password the password
  40. * @return bool true if successful
  41. */
  42. public function login($user, $password);
  43. /**
  44. * Logs the user out including all the session data
  45. * Logout, destroys session
  46. * @return void
  47. */
  48. public function logout();
  49. /**
  50. * set the currently active user
  51. *
  52. * @param \OCP\IUser|null $user
  53. */
  54. public function setUser($user);
  55. /**
  56. * get the current active user
  57. *
  58. * @return \OCP\IUser|null Current user, otherwise null
  59. */
  60. public function getUser();
  61. /**
  62. * Checks whether the user is logged in
  63. *
  64. * @return bool if logged in
  65. */
  66. public function isLoggedIn();
  67. }