summaryrefslogtreecommitdiffstats
path: root/lib/Controller/PublicShareAuthController.php
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-07-12 07:30:46 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-08-08 10:24:49 +0200
commitefc9d95b22795d043d3b0848eb297172ac1dab47 (patch)
tree8fd0dd379d038d19c8f23823f5856066dbe17e09 /lib/Controller/PublicShareAuthController.php
parent94b4a185056e3969b1962b1b2854bf7cb24e939f (diff)
Send notification to the sharer that a password has been requested
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'lib/Controller/PublicShareAuthController.php')
-rw-r--r--lib/Controller/PublicShareAuthController.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Controller/PublicShareAuthController.php b/lib/Controller/PublicShareAuthController.php
index 5d505bcef..d2e0e4bde 100644
--- a/lib/Controller/PublicShareAuthController.php
+++ b/lib/Controller/PublicShareAuthController.php
@@ -33,6 +33,7 @@ use OCP\IL10N;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserManager;
+use OCP\Notification\IManager as NotificationManager;
use OCP\Share\IManager as ShareManager;
use OCP\Share\Exceptions\ShareNotFound;
@@ -40,6 +41,8 @@ class PublicShareAuthController extends OCSController {
/** @var IUserManager */
private $userManager;
+ /** @var NotificationManager */
+ private $notificationManager;
/** @var ShareManager */
private $shareManager;
/** @var Manager */
@@ -51,6 +54,7 @@ class PublicShareAuthController extends OCSController {
* @param string $appName
* @param IRequest $request
* @param IUserManager $userManager
+ * @param NotificationManager $notificationManager
* @param ShareManager $shareManager
* @param Manager $manager
* @param IL10N $l10n
@@ -59,12 +63,14 @@ class PublicShareAuthController extends OCSController {
string $appName,
IRequest $request,
IUserManager $userManager,
+ NotificationManager $notificationManager,
ShareManager $shareManager,
Manager $manager,
IL10N $l10n
) {
parent::__construct($appName, $request);
$this->userManager = $userManager;
+ $this->notificationManager = $notificationManager;
$this->shareManager = $shareManager;
$this->manager = $manager;
$this->l10n = $l10n;
@@ -130,6 +136,18 @@ class PublicShareAuthController extends OCSController {
'participantType' => Participant::OWNER,
]);
+ // Notify the owner
+ $notification = $this->notificationManager->createNotification();
+ $notification
+ ->setApp('spreed')
+ ->setObject('room', $room->getToken())
+ ->setUser($sharerUser->getUID())
+ ->setSubject('share:password', [
+ 'sharedWith' => $share->getSharedWith(),
+ ])
+ ->setDateTime(new \DateTime());
+ $this->notificationManager->notify($notification);
+
return new DataResponse([
'token' => $room->getToken(),
'name' => $room->getName(),