mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-12 01:54:57 +00:00
setDefaultAccess() cleanly removes als notifiers without read access
This failed because the first call of removeNotify() has invalidated the list of notifiers
This commit is contained in:
parent
65aa3eca27
commit
1bd1198335
|
@ -333,6 +333,14 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
return $this->_defaultAccess;
|
return $this->_defaultAccess;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set default access mode
|
||||||
|
*
|
||||||
|
* This method sets the default access mode and also removes all notifiers which
|
||||||
|
* will not have read access anymore.
|
||||||
|
*
|
||||||
|
* @param integer $mode access mode
|
||||||
|
*/
|
||||||
function setDefaultAccess($mode) { /* {{{ */
|
function setDefaultAccess($mode) { /* {{{ */
|
||||||
$db = $this->_dms->getDB();
|
$db = $this->_dms->getDB();
|
||||||
|
|
||||||
|
@ -346,12 +354,18 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
// remove their subscription.
|
// remove their subscription.
|
||||||
if (empty($this->_notifyList))
|
if (empty($this->_notifyList))
|
||||||
$this->getNotifyList();
|
$this->getNotifyList();
|
||||||
foreach ($this->_notifyList["users"] as $u) {
|
|
||||||
|
/* Make a copy of both notifier lists because removeNotify will empty
|
||||||
|
* $this->_notifyList and the second foreach will not work anymore.
|
||||||
|
*/
|
||||||
|
$nusers = $this->_notifyList["users"];
|
||||||
|
$ngroups = $this->_notifyList["groups"];
|
||||||
|
foreach ($nusers as $u) {
|
||||||
if ($this->getAccessMode($u) < M_READ) {
|
if ($this->getAccessMode($u) < M_READ) {
|
||||||
$this->removeNotify($u->getID(), true);
|
$this->removeNotify($u->getID(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($this->_notifyList["groups"] as $g) {
|
foreach ($ngroups as $g) {
|
||||||
if ($this->getGroupAccessMode($g) < M_READ) {
|
if ($this->getGroupAccessMode($g) < M_READ) {
|
||||||
$this->removeNotify($g->getID(), false);
|
$this->removeNotify($g->getID(), false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user