summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-02-01 15:23:01 +0100
committerGitHub <noreply@github.com>2019-02-01 15:23:01 +0100
commite5d8645f00b35467002b37eaa0c7fbec715b7c1c (patch)
tree5ae429ccc8a224144c9460bbac197f1af642982e /lib
parentba03c1a84cee11d5d0ef9b28d79c5df397869c73 (diff)
parentc09ddf6c78cfd29de739d7b639700dab8b15707e (diff)
downloadnextcloud-server-e5d8645f00b35467002b37eaa0c7fbec715b7c1c.tar.gz
nextcloud-server-e5d8645f00b35467002b37eaa0c7fbec715b7c1c.zip
Merge pull request #13846 from nextcloud/feature/check-if-app-exist-for-group
Check app path for enableAppForGroups
Diffstat (limited to 'lib')
-rw-r--r--lib/private/App/AppManager.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index 94addb2b785..7d4dbbbd34e 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -254,15 +254,16 @@ class AppManager implements IAppManager {
*
* @param string $appId
* @param \OCP\IGroup[] $groups
- * @throws \Exception if app can't be enabled for groups
+ * @throws \InvalidArgumentException if app can't be enabled for groups
+ * @throws AppPathNotFoundException
*/
public function enableAppForGroups($appId, $groups) {
+ // Check if app exists
+ $this->getAppPath($appId);
+
$info = $this->getAppInfo($appId);
- if (!empty($info['types'])) {
- $protectedTypes = array_intersect($this->protectedAppTypes, $info['types']);
- if (!empty($protectedTypes)) {
- throw new \Exception("$appId can't be enabled for groups.");
- }
+ if (!empty($info['types']) && $this->hasProtectedAppType($info['types'])) {
+ throw new \InvalidArgumentException("$appId can't be enabled for groups.");
}
$groupIds = array_map(function ($group) {