Skip to content

Commit

Permalink
Fix detecting groupware resources allowed to sync.
Browse files Browse the repository at this point in the history
We must restrict to Horde_Perms::DELETE since EAS clients do not
have an idea of permissions, and will forever continue trying to
delete an item.
  • Loading branch information
mrubinsk committed Apr 24, 2016
1 parent 24c2101 commit a3b0b5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions config/prefs.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@
$enum = array();
$sync = @unserialize($GLOBALS['prefs']->getValue('sync_notepads'));
if (empty($sync)) {
$GLOBALS['prefs']->setValue('sync_notepads', serialize(array(Mnemo::getDefaultNotepad())));
$GLOBALS['prefs']->setValue('sync_notepads', serialize(array(Mnemo::getDefaultNotepad(Horde_Perms::DELETE))));
}
foreach (Mnemo::listNotepads(false, Horde_Perms::EDIT) as $key => $list) {
if ($list->getName() != Mnemo::getDefaultNotepad(Horde_Perms::EDIT)) {
foreach (Mnemo::listNotepads(false, Horde_Perms::DELETE) as $key => $list) {
if ($list->getName() != Mnemo::getDefaultNotepad(Horde_Perms::DELETE)) {
$enum[$key] = Mnemo::getLabel($list);
}
}
Expand All @@ -123,7 +123,7 @@
'on_change' => function() {
$sync = @unserialize($GLOBALS['prefs']->getValue('sync_notepads'));
$haveDefault = false;
$default = Mnemo::getDefaultNotepad(Horde_Perms::EDIT);
$default = Mnemo::getDefaultNotepad(Horde_Perms::DELETE);
foreach ($sync as $cid) {
if ($cid == $default) {
$haveDefault = true;
Expand Down
4 changes: 2 additions & 2 deletions lib/Mnemo.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ static public function getSyncNotepads($prune = false)
$cs = unserialize($GLOBALS['prefs']->getValue('sync_notepads'));
if (!empty($cs)) {
if ($prune) {
$notepads = self::listNotepads(true, Horde_Perms::EDIT);
$notepads = self::listNotepads(true, Horde_Perms::DELETE);
$cscopy = array_flip($cs);
foreach ($cs as $c) {
if (empty($notepads[$c])) {
Expand All @@ -552,7 +552,7 @@ static public function getSyncNotepads($prune = false)
return $cs;
}

if ($cs = self::getDefaultNotepad(Horde_Perms::EDIT)) {
if ($cs = self::getDefaultNotepad(Horde_Perms::DELETE)) {
return array($cs);
}

Expand Down

0 comments on commit a3b0b5d

Please sign in to comment.