iusersession.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. }