IUserSession.php 2.0 KB

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