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 191d223 commit 3ef2b66
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions kronolith/config/prefs.php
Expand Up @@ -284,8 +284,8 @@
if (empty($sync)) {
$GLOBALS['prefs']->setValue('sync_calendars', serialize(array(Kronolith::getDefaultCalendar(Horde_Perms::EDIT))));
}
foreach (Kronolith::listInternalCalendars(false, Horde_Perms::EDIT) as $key => $cal) {
if ($cal->getName() != Kronolith::getDefaultCalendar(Horde_Perms::EDIT)) {
foreach (Kronolith::listInternalCalendars(false, Horde_Perms::DELETE) as $key => $cal) {
if ($cal->getName() != Kronolith::getDefaultCalendar(Horde_Perms::DELETE)) {
$enum[$key] = Kronolith::getLabel($cal);
}
}
Expand All @@ -294,7 +294,7 @@
'on_change' => function() {
$sync = @unserialize($GLOBALS['prefs']->getValue('sync_calendars'));
$haveDefault = false;
$default = Kronolith::getDefaultCalendar(Horde_Perms::EDIT);
$default = Kronolith::getDefaultCalendar(Horde_Perms::DELETE);
foreach ($sync as $cid) {
if ($cid == $default) {
$haveDefault = true;
Expand Down
2 changes: 1 addition & 1 deletion kronolith/lib/Kronolith.php
Expand Up @@ -1173,7 +1173,7 @@ public static function getSyncCalendars($prune = false)
$cs = unserialize($GLOBALS['prefs']->getValue('sync_calendars'));
if (!empty($cs)) {
if ($prune) {
$calendars = self::listInternalCalendars(true, Horde_Perms::EDIT);
$calendars = self::listInternalCalendars(false, Horde_Perms::DELETE);
$cscopy = array_flip($cs);
foreach ($cs as $c) {
if (empty($calendars[$c])) {
Expand Down
8 changes: 4 additions & 4 deletions mnemo/config/prefs.php
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 mnemo/lib/Mnemo.php
Expand Up @@ -537,7 +537,7 @@ public static 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 @@ public static 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
8 changes: 4 additions & 4 deletions nag/config/prefs.php
Expand Up @@ -284,10 +284,10 @@
$enum = array();
$sync = @unserialize($GLOBALS['prefs']->getValue('sync_lists'));
if (empty($sync)) {
$GLOBALS['prefs']->setValue('sync_lists', serialize(array(Nag::getDefaultTasklist())));
$GLOBALS['prefs']->setValue('sync_lists', serialize(array(Nag::getDefaultTasklist(Horde_Perms::DELETE))));
}
foreach (Nag::listTasklists(false, Horde_Perms::EDIT, false) as $key => $list) {
if ($list->getName() != Nag::getDefaultTasklist(Horde_Perms::EDIT)) {
foreach (Nag::listTasklists(false, Horde_Perms::DELETE, false) as $key => $list) {
if ($list->getName() != Nag::getDefaultTasklist(Horde_Perms::DELETE)) {
$enum[$key] = Nag::getLabel($list);
}
}
Expand All @@ -296,7 +296,7 @@
'on_change' => function() {
$sync = @unserialize($GLOBALS['prefs']->getValue('sync_lists'));
$haveDefault = false;
$default = Nag::getDefaultTasklist(Horde_Perms::EDIT);
$default = Nag::getDefaultTasklist(Horde_Perms::DELETE);
foreach ($sync as $cid) {
if ($cid == $default) {
$haveDefault = true;
Expand Down
2 changes: 1 addition & 1 deletion nag/lib/Nag.php
Expand Up @@ -1728,7 +1728,7 @@ public static function getSyncLists()
$cs = unserialize($GLOBALS['prefs']->getValue('sync_lists'));
if (!empty($cs)) {
// Have a pref, make sure it's still available
$lists = self::listTasklists(false, Horde_Perms::EDIT);
$lists = self::listTasklists(false, Horde_Perms::DELETE);
$cscopy = array_flip($cs);
foreach ($cs as $c) {
if (empty($lists[$c])) {
Expand Down
2 changes: 1 addition & 1 deletion turba/config/prefs.php
Expand Up @@ -55,7 +55,7 @@
if (empty($sync_books)) {
$GLOBALS['prefs']->setValue('sync_books', serialize(array(Turba::getDefaultAddressbook())));
}
foreach (Turba::getAddressBooks() as $key => $val) {
foreach (Turba::getAddressBooks(Horde_Perms::DELETE) as $key => $val) {
if (!empty($val['map']['__uid']) &&
!empty($val['browse'])) {
$enum[$key] = $val['title'];
Expand Down

0 comments on commit 3ef2b66

Please sign in to comment.