summaryrefslogtreecommitdiffstats
path: root/apps/updatenotification/lib
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-05-09 09:43:06 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2016-05-24 11:26:52 +0200
commitc34788918d83ff3f10c44d2c8cb7dfde09b326a5 (patch)
treed23c75730244913a7a372495c8dde1d6c2acc819 /apps/updatenotification/lib
parentd2553a4f6e14181d7788e42d1c70285ebb40f736 (diff)
downloadnextcloud-server-c34788918d83ff3f10c44d2c8cb7dfde09b326a5.tar.gz
nextcloud-server-c34788918d83ff3f10c44d2c8cb7dfde09b326a5.zip
Make the group selectable
Diffstat (limited to 'apps/updatenotification/lib')
-rw-r--r--apps/updatenotification/lib/Controller/AdminController.php5
-rw-r--r--apps/updatenotification/lib/Notification/BackgroundJob.php11
2 files changed, 14 insertions, 2 deletions
diff --git a/apps/updatenotification/lib/Controller/AdminController.php b/apps/updatenotification/lib/Controller/AdminController.php
index 5dbcc685809..c622b9690a7 100644
--- a/apps/updatenotification/lib/Controller/AdminController.php
+++ b/apps/updatenotification/lib/Controller/AdminController.php
@@ -100,12 +100,17 @@ class AdminController extends Controller {
unset($channels[$key]);
}
$updateState = $this->updateChecker->getUpdateState();
+
+ $notifyGroups = json_decode($this->config->getAppValue('updatenotification', 'notify_groups', '["admin"]'));
+
$params = [
'isNewVersionAvailable' => ($updateState === []) ? false : true,
'lastChecked' => $lastUpdateCheck,
'currentChannel' => $currentChannel,
'channels' => $channels,
'newVersionString' => ($updateState === []) ? '' : $updateState['updateVersion'],
+
+ 'notify_groups' => implode('|', $notifyGroups),
];
return new TemplateResponse($this->appName, 'admin', $params, '');
diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php
index 7661f073e7b..f2cf7e1cd85 100644
--- a/apps/updatenotification/lib/Notification/BackgroundJob.php
+++ b/apps/updatenotification/lib/Notification/BackgroundJob.php
@@ -28,6 +28,7 @@ use OC\Updater\VersionCheck;
use OCP\App\IAppManager;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
+use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\Notification\IManager;
@@ -149,8 +150,14 @@ class BackgroundJob extends TimedJob {
return $this->users;
}
- $groupToNotify = $this->groupManager->get('admin');
- $this->users = $groupToNotify->getUsers();
+ $notifyGroups = json_decode($this->config->getAppValue('updatenotification', 'notify_groups', '["admin"]'));
+ foreach ($notifyGroups as $group) {
+ $groupToNotify = $this->groupManager->get($group);
+ if ($groupToNotify instanceof IGroup) {
+ $this->users = array_merge($this->users, $groupToNotify->getUsers());
+ }
+ }
+
return $this->users;
}