User.php 2.7 KB

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