Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 49e44e2

Browse files
committed
Fix un-removed notification by checking ACL when listing the watches and updating metadata accordingly.
1 parent f3d29f1 commit 49e44e2

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

core/src/plugins/meta.watch/class.MetaWatchRegister.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ public function setWatchOnFolder($node, $userId, $watchType, $targetUsers = arra
116116
* @param AJXP_Node $node
117117
* @param $userId
118118
* @param bool $clearUsers
119+
* @param bool $targetUserId
119120
*/
120121
public function removeWatchFromFolder($node, $userId, $clearUsers = false, $targetUserId = false)
121122
{
@@ -181,6 +182,7 @@ public function removeWatchFromFolder($node, $userId, $clearUsers = false, $targ
181182
* @param AJXP_Node $node
182183
* @param $userId
183184
* @param string $ns Watch namespace
185+
* @param array $result
184186
* @return string|bool the type of watch
185187
*/
186188
public function hasWatchOnNode($node, $userId, $ns = "META_WATCH", &$result = array())
@@ -320,9 +322,22 @@ private function loadWatchesFromMeta($watchType, $currentUserId, $node, $watchMe
320322
continue;
321323
}
322324
if (!AuthService::userExists($id)) {
323-
$changes = true;
324-
unset($watchMeta[$id]);
325325
unset($IDS[$index]);
326+
if(is_array($watchMeta)){
327+
$changes = true;
328+
$watchMeta[$id] = AJXP_VALUE_CLEAR;
329+
}
330+
}else{
331+
// Make sure the user is still authorized on this node, otherwise remove it.
332+
$uObject = ConfService::getConfStorageImpl()->createUserObject($id);
333+
$acl = $uObject->mergedRole->getAcl($node->getRepositoryId());
334+
if(empty($acl) || strpos($acl, "r") === FALSE){
335+
unset($IDS[$index]);
336+
if(is_array($watchMeta)){
337+
$changes = true;
338+
$watchMeta[$id] = AJXP_VALUE_CLEAR;
339+
}
340+
}
326341
}
327342
}
328343
if ($changes) {

0 commit comments

Comments
 (0)