From 5937d98cb33aec1da939d7a8b41971c60bc49052 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 8 Dec 2016 18:11:35 +0100 Subject: [PATCH] do not send notif. to old owner, send notif. if access rights are inherited again --- op/op.DocumentAccess.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/op/op.DocumentAccess.php b/op/op.DocumentAccess.php index eccd807dd..300d94d5c 100644 --- a/op/op.DocumentAccess.php +++ b/op/op.DocumentAccess.php @@ -142,7 +142,7 @@ if ($action == "setowner") { foreach ($notifyList["groups"] as $grp) { $notifier->toGroup($user, $grp, $subject, $message, $params); } - $notifier->toIndividual($user, $oldOwner, $subject, $message, $params); +// $notifier->toIndividual($user, $oldOwner, $subject, $message, $params); } } @@ -205,8 +205,26 @@ else if ($action == "notinherit") { // Change to inherit----------------------------------------------------- else if ($action == "inherit") { - $document->clearAccessList(); - $document->setInheritAccess(true); + if($document->clearAccessList() && $document->setInheritAccess(true)) { + if($notifier) { + $notifyList = $document->getNotifyList(); + $folder = $document->getFolder(); + $subject = "access_permission_changed_email_subject"; + $message = "access_permission_changed_email_body"; + $params = array(); + $params['name'] = $document->getName(); + $params['folder_path'] = $folder->getFolderPathPlain(); + $params['username'] = $user->getFullName(); + $params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); + $params['sitename'] = $settings->_siteName; + $params['http_root'] = $settings->_httpRoot; + $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + foreach ($notifyList["groups"] as $grp) { + $notifier->toGroup($user, $grp, $subject, $message, $params); + } + + } + } } // Set default permissions ----------------------------------------------