IAppManager.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Daniel Rudolf <github.com@daniel-rudolf.de>
  6. * @author Greta Doci <gretadoci@gmail.com>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Julius Haertl <jus@bitgrid.net>
  9. * @author Julius Härtl <jus@bitgrid.net>
  10. * @author Lukas Reschke <lukas@statuscode.ch>
  11. * @author Morris Jobke <hey@morrisjobke.de>
  12. * @author Robin Appelman <robin@icewind.nl>
  13. * @author Roeland Jago Douma <roeland@famdouma.nl>
  14. * @author Thomas Müller <thomas.mueller@tmit.eu>
  15. *
  16. * @license AGPL-3.0
  17. *
  18. * This code is free software: you can redistribute it and/or modify
  19. * it under the terms of the GNU Affero General Public License, version 3,
  20. * as published by the Free Software Foundation.
  21. *
  22. * This program is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU Affero General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU Affero General Public License, version 3,
  28. * along with this program. If not, see <http://www.gnu.org/licenses/>
  29. *
  30. */
  31. namespace OCP\App;
  32. use OCP\IGroup;
  33. use OCP\IUser;
  34. /**
  35. * Interface IAppManager
  36. *
  37. * @package OCP\App
  38. * @since 8.0.0
  39. */
  40. interface IAppManager {
  41. /**
  42. * Returns the app information from "appinfo/info.xml".
  43. *
  44. * @param string $appId
  45. * @return mixed
  46. * @since 14.0.0
  47. */
  48. public function getAppInfo(string $appId, bool $path = false, $lang = null);
  49. /**
  50. * Returns the app information from "appinfo/info.xml".
  51. *
  52. * @param string $appId
  53. * @param bool $useCache
  54. * @return string
  55. * @since 14.0.0
  56. */
  57. public function getAppVersion(string $appId, bool $useCache = true): string;
  58. /**
  59. * Check if an app is enabled for user
  60. *
  61. * @param string $appId
  62. * @param \OCP\IUser $user (optional) if not defined, the currently loggedin user will be used
  63. * @return bool
  64. * @since 8.0.0
  65. */
  66. public function isEnabledForUser($appId, $user = null);
  67. /**
  68. * Check if an app is enabled in the instance
  69. *
  70. * Notice: This actually checks if the app is enabled and not only if it is installed.
  71. *
  72. * @param string $appId
  73. * @return bool
  74. * @since 8.0.0
  75. */
  76. public function isInstalled($appId);
  77. /**
  78. * Enable an app for every user
  79. *
  80. * @param string $appId
  81. * @param bool $forceEnable
  82. * @throws AppPathNotFoundException
  83. * @since 8.0.0
  84. */
  85. public function enableApp(string $appId, bool $forceEnable = false): void;
  86. /**
  87. * Whether a list of types contains a protected app type
  88. *
  89. * @param string[] $types
  90. * @return bool
  91. * @since 12.0.0
  92. */
  93. public function hasProtectedAppType($types);
  94. /**
  95. * Enable an app only for specific groups
  96. *
  97. * @param string $appId
  98. * @param \OCP\IGroup[] $groups
  99. * @param bool $forceEnable
  100. * @throws \Exception
  101. * @since 8.0.0
  102. */
  103. public function enableAppForGroups(string $appId, array $groups, bool $forceEnable = false): void;
  104. /**
  105. * Disable an app for every user
  106. *
  107. * @param string $appId
  108. * @param bool $automaticDisabled
  109. * @since 8.0.0
  110. */
  111. public function disableApp($appId, $automaticDisabled = false);
  112. /**
  113. * Get the directory for the given app.
  114. *
  115. * @param string $appId
  116. * @return string
  117. * @since 11.0.0
  118. * @throws AppPathNotFoundException
  119. */
  120. public function getAppPath($appId);
  121. /**
  122. * Get the web path for the given app.
  123. *
  124. * @param string $appId
  125. * @return string
  126. * @since 18.0.0
  127. * @throws AppPathNotFoundException
  128. */
  129. public function getAppWebPath(string $appId): string;
  130. /**
  131. * List all apps enabled for a user
  132. *
  133. * @param \OCP\IUser $user
  134. * @return string[]
  135. * @since 8.1.0
  136. */
  137. public function getEnabledAppsForUser(IUser $user);
  138. /**
  139. * List all installed apps
  140. *
  141. * @return string[]
  142. * @since 8.1.0
  143. */
  144. public function getInstalledApps();
  145. /**
  146. * Clear the cached list of apps when enabling/disabling an app
  147. * @since 8.1.0
  148. */
  149. public function clearAppsCache();
  150. /**
  151. * @param string $appId
  152. * @return boolean
  153. * @since 9.0.0
  154. */
  155. public function isShipped($appId);
  156. /**
  157. * @return string[]
  158. * @since 9.0.0
  159. */
  160. public function getAlwaysEnabledApps();
  161. /**
  162. * @param \OCP\IGroup $group
  163. * @return String[]
  164. * @since 17.0.0
  165. */
  166. public function getEnabledAppsForGroup(IGroup $group): array;
  167. /**
  168. * @return array
  169. * @since 17.0.0
  170. */
  171. public function getAutoDisabledApps(): array;
  172. /**
  173. * @param String $appId
  174. * @return string[]
  175. * @since 17.0.0
  176. */
  177. public function getAppRestriction(string $appId): array;
  178. }