1
0

IAppManager.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. * @author Julius Haertl <jus@bitgrid.net>
  7. * @author Lukas Reschke <lukas@statuscode.ch>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Robin Appelman <robin@icewind.nl>
  10. * @author Thomas Müller <thomas.mueller@tmit.eu>
  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. namespace OCP\App;
  28. use OCP\IUser;
  29. /**
  30. * Interface IAppManager
  31. *
  32. * @package OCP\App
  33. * @since 8.0.0
  34. */
  35. interface IAppManager {
  36. /**
  37. * Check if an app is enabled for user
  38. *
  39. * @param string $appId
  40. * @param \OCP\IUser $user (optional) if not defined, the currently loggedin user will be used
  41. * @return bool
  42. * @since 8.0.0
  43. */
  44. public function isEnabledForUser($appId, $user = null);
  45. /**
  46. * Check if an app is installed in the instance
  47. *
  48. * @param string $appId
  49. * @return bool
  50. * @since 8.0.0
  51. */
  52. public function isInstalled($appId);
  53. /**
  54. * Enable an app for every user
  55. *
  56. * @param string $appId
  57. * @throws AppPathNotFoundException
  58. * @since 8.0.0
  59. */
  60. public function enableApp($appId);
  61. /**
  62. * Whether a list of types contains a protected app type
  63. *
  64. * @param string[] $types
  65. * @return bool
  66. * @since 12.0.0
  67. */
  68. public function hasProtectedAppType($types);
  69. /**
  70. * Enable an app only for specific groups
  71. *
  72. * @param string $appId
  73. * @param \OCP\IGroup[] $groups
  74. * @since 8.0.0
  75. */
  76. public function enableAppForGroups($appId, $groups);
  77. /**
  78. * Disable an app for every user
  79. *
  80. * @param string $appId
  81. * @since 8.0.0
  82. */
  83. public function disableApp($appId);
  84. /**
  85. * Get the directory for the given app.
  86. *
  87. * @param string $appId
  88. * @return string
  89. * @since 11.0.0
  90. * @throws AppPathNotFoundException
  91. */
  92. public function getAppPath($appId);
  93. /**
  94. * List all apps enabled for a user
  95. *
  96. * @param \OCP\IUser $user
  97. * @return string[]
  98. * @since 8.1.0
  99. */
  100. public function getEnabledAppsForUser(IUser $user);
  101. /**
  102. * List all installed apps
  103. *
  104. * @return string[]
  105. * @since 8.1.0
  106. */
  107. public function getInstalledApps();
  108. /**
  109. * Clear the cached list of apps when enabling/disabling an app
  110. * @since 8.1.0
  111. */
  112. public function clearAppsCache();
  113. /**
  114. * @param string $appId
  115. * @return boolean
  116. * @since 9.0.0
  117. */
  118. public function isShipped($appId);
  119. /**
  120. * @return string[]
  121. * @since 9.0.0
  122. */
  123. public function getAlwaysEnabledApps();
  124. }