You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. *
  43. * @param string $user the username
  44. * @param string $password the password
  45. * @return bool true if successful
  46. * @since 6.0.0
  47. */
  48. public function login($user, $password);
  49. /**
  50. * Logs the user out including all the session data
  51. * Logout, destroys session
  52. *
  53. * @return void
  54. * @since 6.0.0
  55. */
  56. public function logout();
  57. /**
  58. * set the currently active user
  59. *
  60. * @param \OCP\IUser|null $user
  61. * @since 8.0.0
  62. */
  63. public function setUser($user);
  64. /**
  65. * get the current active user
  66. *
  67. * @return \OCP\IUser|null Current user, otherwise null
  68. * @since 8.0.0
  69. */
  70. public function getUser();
  71. /**
  72. * Checks whether the user is logged in
  73. *
  74. * @return bool if logged in
  75. * @since 8.0.0
  76. */
  77. public function isLoggedIn();
  78. /**
  79. * get getImpersonatingUserID
  80. *
  81. * @return string|null
  82. * @since 18.0.0
  83. */
  84. public function getImpersonatingUserID(): ?string;
  85. /**
  86. * set setImpersonatingUserID
  87. *
  88. * @since 18.0.0
  89. */
  90. public function setImpersonatingUserID(bool $useCurrentUser = true): void;
  91. }