diff options
Diffstat (limited to 'lib/private/App/AppManager.php')
-rw-r--r-- | lib/private/App/AppManager.php | 13 |
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) { |