iusersession.php 1.9 KB

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