From 3c92ebd94209b149216f586bc4943c626cf89856 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 31 Aug 2023 17:39:43 +0200 Subject: [PATCH] send notifications when adding and deleting access --- op/op.FolderAccess.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/op/op.FolderAccess.php b/op/op.FolderAccess.php index 63de4210f..ec5c5368b 100644 --- a/op/op.FolderAccess.php +++ b/op/op.FolderAccess.php @@ -182,13 +182,20 @@ else if ($action == "setdefault") { // Modify permission ------------------------------------------------------ else if ($action == "editaccess") { + $oldmode = $mode; if (isset($userid)) { - $folder->changeAccess($mode, $userid, true); + $oldmode = $folder->changeAccess($mode, $userid, true); } else if (isset($groupid)) { - $folder->changeAccess($mode, $groupid, false); + $oldmode = $folder->changeAccess($mode, $groupid, false); + } + if($oldmode != $mode) { + if($notifier) { + // Send notification to subscribers. + $notifier->sendChangedFolderAccessMail($folder, $user); + } + $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_access'))); } - $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_access'))); } // Delete Permission ------------------------------------------------------ @@ -200,6 +207,10 @@ else if ($action == "delaccess") { else if (isset($groupid)) { $folder->removeAccess($groupid, false); } + if($notifier) { + // Send notification to subscribers. + $notifier->sendChangedFolderAccessMail($folder, $user); + } $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_delete_access'))); } @@ -212,6 +223,10 @@ else if ($action == "addaccess") { if (isset($groupid) && $groupid != -1) { $folder->addAccess($mode, $groupid, false); } + if($notifier) { + // Send notification to subscribers. + $notifier->sendChangedFolderAccessMail($folder, $user); + } $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_add_access'))); }