diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2019-03-04 17:24:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-04 17:24:51 +0300 |
commit | c387044b53157dcbbb600db06f6bd0a3e409d668 (patch) | |
tree | b75ca9292dfffd189314f4b2f8886242485b28f5 /lib/Activity | |
parent | 9790699c274deb378c15e000410f321d85ee7cfe (diff) | |
parent | 12f9c98ea183dcefe261c6692bffd093d69e0a31 (diff) |
Merge pull request #1585 from nextcloud/feature/1105/allow-to-restrict-to-group
Allow to restrict to group
Diffstat (limited to 'lib/Activity')
-rw-r--r-- | lib/Activity/Provider/Base.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Activity/Provider/Base.php b/lib/Activity/Provider/Base.php index 137eb2a35..0b4da5a7b 100644 --- a/lib/Activity/Provider/Base.php +++ b/lib/Activity/Provider/Base.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace OCA\Spreed\Activity\Provider; +use OCA\Spreed\Config; use OCA\Spreed\Manager; use OCA\Spreed\Room; use OCP\Activity\IEvent; @@ -37,16 +38,14 @@ abstract class Base implements IProvider { /** @var IFactory */ protected $languageFactory; - /** @var IURLGenerator */ protected $url; - + /** @var Config */ + protected $config; /** @var IManager */ protected $activityManager; - /** @var IUserManager */ protected $userManager; - /** @var Manager */ protected $manager; @@ -55,11 +54,13 @@ abstract class Base implements IProvider { public function __construct(IFactory $languageFactory, IURLGenerator $url, + Config $config, IManager $activityManager, IUserManager $userManager, Manager $manager) { $this->languageFactory = $languageFactory; $this->url = $url; + $this->config = $config; $this->activityManager = $activityManager; $this->userManager = $userManager; $this->manager = $manager; @@ -75,6 +76,11 @@ abstract class Base implements IProvider { throw new \InvalidArgumentException('Wrong app'); } + $user = $this->userManager->get($event->getAffectedUser()); + if (!$user instanceof IUser || $this->config->isDisabledForUser($user)) { + throw new \InvalidArgumentException('User can not user Talk'); + } + if ($this->activityManager->getRequirePNG()) { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('spreed', 'app-dark.png'))); } else { |