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.

85 lines
2.5 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bart Visscher <bartv@thisnet.nl>
  6. * @author Frank Karlitschek <frank@karlitschek.de>
  7. * @author Georg Ehrke <oc.list@georgehrke.com>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Roeland Jago Douma <roeland@famdouma.nl>
  10. * @author Sebastian Wessalowski <sebastian@wessalowski.org>
  11. * @author Thomas Müller <thomas.mueller@tmit.eu>
  12. *
  13. * @license AGPL-3.0
  14. *
  15. * This code is free software: you can redistribute it and/or modify
  16. * it under the terms of the GNU Affero General Public License, version 3,
  17. * as published by the Free Software Foundation.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU Affero General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU Affero General Public License, version 3,
  25. * along with this program. If not, see <http://www.gnu.org/licenses/>
  26. *
  27. */
  28. /**
  29. * Public interface of ownCloud for apps to use.
  30. * User Class
  31. *
  32. */
  33. // use OCP namespace for all classes that are considered public.
  34. // This means that they should be used by apps instead of the internal ownCloud classes
  35. namespace OCP;
  36. /**
  37. * This class provides access to the user management. You can get information
  38. * about the currently logged in user and the permissions for example
  39. * @since 5.0.0
  40. * @deprecated 13.0.0
  41. */
  42. class User {
  43. /**
  44. * Get the user id of the user currently logged in.
  45. * @return string uid or false
  46. * @deprecated 8.0.0 Use \OC::$server->getUserSession()->getUser()->getUID()
  47. * @since 5.0.0
  48. */
  49. public static function getUser() {
  50. return \OC_User::getUser();
  51. }
  52. /**
  53. * Check if the user is logged in
  54. * @return boolean
  55. * @since 5.0.0
  56. * @deprecated 13.0.0 Use annotation based ACLs from the AppFramework instead
  57. */
  58. public static function isLoggedIn() {
  59. return \OC::$server->getUserSession()->isLoggedIn();
  60. }
  61. /**
  62. * Check if the user is a admin, redirects to home if not
  63. * @since 5.0.0
  64. * @deprecated 13.0.0 Use annotation based ACLs from the AppFramework instead
  65. */
  66. public static function checkAdminUser() {
  67. \OC_Util::checkAdminUser();
  68. }
  69. /**
  70. * Check if the user is logged in, redirects to home if not. With
  71. * redirect URL parameter to the request URI.
  72. * @since 5.0.0
  73. * @deprecated 13.0.0 Use annotation based ACLs from the AppFramework instead
  74. */
  75. public static function checkLoggedIn() {
  76. \OC_Util::checkLoggedIn();
  77. }
  78. }