diff options
author | Thomas Citharel <tcit@tcit.fr> | 2021-03-19 18:55:39 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-03-23 14:33:12 +0300 |
commit | b58dd9ee6018a9809f6359c1d355ce7f95392ac0 (patch) | |
tree | 82598f4fbfe72dc23168080d3cc0319fb0edd719 /lib/Service | |
parent | c8d2059c2ef25e4fd6ab472e88294c23cd7c5593 (diff) |
Respect allow/disallow group sharing setting in group service
Some instances don't want to allow sending emails to everyone in a group
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/Group/NextcloudGroupService.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/Service/Group/NextcloudGroupService.php b/lib/Service/Group/NextcloudGroupService.php index 2c3dd1a72..ca3dce3cd 100644 --- a/lib/Service/Group/NextcloudGroupService.php +++ b/lib/Service/Group/NextcloudGroupService.php @@ -4,6 +4,7 @@ declare(strict_types=1); /** * @author Matthias Rella <mrella@pisys.eu> + * @author Thomas Citharel <nextcloud@tcit.fr> * * Mail * @@ -23,6 +24,7 @@ declare(strict_types=1); namespace OCA\Mail\Service\Group; +use OCP\IConfig; use OCP\IGroupManager; use OCA\Mail\Exception\ServiceException; @@ -36,14 +38,20 @@ class NextcloudGroupService implements IGroupService { private $groupManager; /** + * @var IConfig + */ + private $config; + + /** * Group's namespace * * @var string */ private $namespace = "Nextcloud"; - public function __construct(IGroupManager $groupManager) { + public function __construct(IGroupManager $groupManager, IConfig $config) { $this->groupManager = $groupManager; + $this->config = $config; } public function getNamespace(): string { @@ -51,6 +59,9 @@ class NextcloudGroupService implements IGroupService { } public function search(string $term): array { + if ($this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') !== 'yes') { + return []; + } $groups = $this->groupManager->search($term); return array_map( |