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