iusersession.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. * @since 6.0.0
  37. */
  38. interface IUserSession {
  39. /**
  40. * Do a user login
  41. * @param string $user the username
  42. * @param string $password the password
  43. * @return bool true if successful
  44. * @since 6.0.0
  45. */
  46. public function login($user, $password);
  47. /**
  48. * Logs the user out including all the session data
  49. * Logout, destroys session
  50. * @return void
  51. * @since 6.0.0
  52. */
  53. public function logout();
  54. /**
  55. * set the currently active user
  56. *
  57. * @param \OCP\IUser|null $user
  58. * @since 8.0.0
  59. */
  60. public function setUser($user);
  61. /**
  62. * get the current active user
  63. *
  64. * @return \OCP\IUser|null Current user, otherwise null
  65. * @since 8.0.0
  66. */
  67. public function getUser();
  68. /**
  69. * Checks whether the user is logged in
  70. *
  71. * @return bool if logged in
  72. * @since 8.0.0
  73. */
  74. public function isLoggedIn();
  75. }