diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2016-01-14 15:23:07 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2016-01-14 15:45:48 +0100 |
commit | e3a08584440b071e1caae7c7ff4f404c38b8794b (patch) | |
tree | fb3aa2d78a743b19427db6d270f9e1f1993c9306 /lib/private/app | |
parent | 0461b9dbb9f800951519fd1ffdb689157614ce99 (diff) | |
download | nextcloud-server-e3a08584440b071e1caae7c7ff4f404c38b8794b.tar.gz nextcloud-server-e3a08584440b071e1caae7c7ff4f404c38b8794b.zip |
Check whether the app can be enabled for groups
Diffstat (limited to 'lib/private/app')
-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(); |