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.

198 lines
4.4 KiB

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