diff options
Diffstat (limited to 'lib/private/app/appmanager.php')
-rw-r--r-- | lib/private/app/appmanager.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/private/app/appmanager.php b/lib/private/app/appmanager.php index 7cb945784bc..bf07a2ef548 100644 --- a/lib/private/app/appmanager.php +++ b/lib/private/app/appmanager.php @@ -35,6 +35,18 @@ use OCP\IUserSession; class AppManager implements IAppManager { + /** + * Apps with these types can not be enabled for certain groups only + * @var string[] + */ + protected $protectedAppTypes = [ + 'filesystem', + 'prelogin', + 'authentication', + 'logging', + 'prevent_group_restriction', + ]; + /** @var \OCP\IUserSession */ private $userSession; @@ -197,8 +209,17 @@ class AppManager implements IAppManager { * * @param string $appId * @param \OCP\IGroup[] $groups + * @throws \Exception if app can't be enabled for groups */ public function enableAppForGroups($appId, $groups) { + $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."); + } + } + $groupIds = array_map(function ($group) { /** @var \OCP\IGroup $group */ return $group->getGID(); |