IAppManager.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. * Returns the app information from "appinfo/info.xml".
  38. *
  39. * @param string $appId
  40. * @return mixed
  41. * @since 14.0.0
  42. */
  43. public function getAppInfo(string $appId, bool $path = false, $lang = null);
  44. /**
  45. * Returns the app information from "appinfo/info.xml".
  46. *
  47. * @param string $appId
  48. * @param bool $useCache
  49. * @return string
  50. * @since 14.0.0
  51. */
  52. public function getAppVersion(string $appId, bool $useCache = true): string;
  53. /**
  54. * Check if an app is enabled for user
  55. *
  56. * @param string $appId
  57. * @param \OCP\IUser $user (optional) if not defined, the currently loggedin user will be used
  58. * @return bool
  59. * @since 8.0.0
  60. */
  61. public function isEnabledForUser($appId, $user = null);
  62. /**
  63. * Check if an app is enabled in the instance
  64. *
  65. * Notice: This actually checks if the app is enabled and not only if it is installed.
  66. *
  67. * @param string $appId
  68. * @return bool
  69. * @since 8.0.0
  70. */
  71. public function isInstalled($appId);
  72. /**
  73. * Enable an app for every user
  74. *
  75. * @param string $appId
  76. * @throws AppPathNotFoundException
  77. * @since 8.0.0
  78. */
  79. public function enableApp($appId);
  80. /**
  81. * Whether a list of types contains a protected app type
  82. *
  83. * @param string[] $types
  84. * @return bool
  85. * @since 12.0.0
  86. */
  87. public function hasProtectedAppType($types);
  88. /**
  89. * Enable an app only for specific groups
  90. *
  91. * @param string $appId
  92. * @param \OCP\IGroup[] $groups
  93. * @throws \Exception
  94. * @since 8.0.0
  95. */
  96. public function enableAppForGroups($appId, $groups);
  97. /**
  98. * Disable an app for every user
  99. *
  100. * @param string $appId
  101. * @since 8.0.0
  102. */
  103. public function disableApp($appId);
  104. /**
  105. * Get the directory for the given app.
  106. *
  107. * @param string $appId
  108. * @return string
  109. * @since 11.0.0
  110. * @throws AppPathNotFoundException
  111. */
  112. public function getAppPath($appId);
  113. /**
  114. * List all apps enabled for a user
  115. *
  116. * @param \OCP\IUser $user
  117. * @return string[]
  118. * @since 8.1.0
  119. */
  120. public function getEnabledAppsForUser(IUser $user);
  121. /**
  122. * List all installed apps
  123. *
  124. * @return string[]
  125. * @since 8.1.0
  126. */
  127. public function getInstalledApps();
  128. /**
  129. * Clear the cached list of apps when enabling/disabling an app
  130. * @since 8.1.0
  131. */
  132. public function clearAppsCache();
  133. /**
  134. * @param string $appId
  135. * @return boolean
  136. * @since 9.0.0
  137. */
  138. public function isShipped($appId);
  139. /**
  140. * @return string[]
  141. * @since 9.0.0
  142. */
  143. public function getAlwaysEnabledApps();
  144. }