Support read-only address-books



  • (#126 is a similar issue, but related to calendars, instead of address books. However, it seems that address books do not seem to have a read-only flag in Android, so this needs to be solved differently.)

    When adding an address book, DAVdroid can identify whether it is read-only or read-write. However, it seems to be unable to make this clear to Android (it seems there is no support for a read-only flag there).

    Changing contacts from this read-only address book results in the problem described in #126: DAVdroid tries to write the changes back and fails with HTTP 403. This is repeated at every sync attempt, resulting every time in an error message the user can do nothing about.

    It also seems that the (automatic or manual) merging of contacts changes them, probably setting some relationship attributes. So having related contacts in read-only address books seems to be an automatic cause for persistent sync errors.

    My suggestion to fix this is as follows.

    1. Try to convey the read-only flag to Android (this is probably not possible; in this case: skip this).
    2. When a 403 occurs when writing to a read-only address book, handle it as follows.
    3. Display the error message, with a clear description of what has caused this and what this means.
    4. Set a flag, causing further writes to the address book to fail silently.
    5. Display this flag in the sync options for this address book to remind the user.

    I do not yet know what is the best way to deal with the changed contacts. I would suggest just to revert them back to the server version on sync. However, if there is some automatically updated linking information, that would need to be preserved in order to avoid an endless syncing loop.



  • Davdroid should offer storing modified contact in another addressbook
    and merge the contacts. If the difference is only in some safely
    discardable metadata (like timestamp of last modification), then
    Davdroid should ignore it during sync.

    One way or another, Davdrodid must make a backup copy (dump vcard file
    somewhere or at least into log) and warn user (and include info about
    backup).

    Marcel Waldvogel wrote, on 24.1.2015 16:59:

    (#126 https://github.com/bitfireAT/davdroid/issues/126 is a similar
    issue, but related to calendars, instead of address books. However, it
    seems that address books do not seem to have a read-only flag in
    Android, so this needs to be solved differently.)

    When adding an address book, DAVdroid can identify whether it is
    read-only or read-write. However, it seems to be unable to make this
    clear to Android (it seems there is no support for a read-only flag there).

    Changing contacts from this read-only address book results in the
    problem described in #126
    https://github.com/bitfireAT/davdroid/issues/126: DAVdroid tries to
    write the changes back and fails with HTTP 403. This is repeated at
    every sync attempt, resulting every time in an error message the user
    can do nothing about.

    It also seems that the (automatic or manual) merging of contacts changes
    them, probably setting some relationship attributes. So having related
    contacts in read-only address books seems to be an automatic cause for
    persistent sync errors.

    My suggestion to fix this is as follows.

    1. Try to convey the read-only flag to Android (this is probably not
      possible; in this case: skip this).
    2. When a 403 occurs when writing to a read-only address book, handle
      it as follows.
      1. Display the error message, with a clear description of what has
        caused this and what this means.
      2. Set a flag, causing further writes to the address book to fail
        silently.
      3. Display this flag in the sync options for this address book to
        remind the user.

    I do not yet know what is the best way to deal with the changed
    contacts. I would suggest just to revert them back to the server version
    on sync. However, if there is some automatically updated linking
    information, that would need to be preserved in order to avoid an
    endless syncing loop.


    Reply to this email directly or view it on GitHub
    https://github.com/bitfireAT/davdroid/issues/434.


  • developer

    I wonder whether syncing read-only address books is in the scope of DAVdroid, especially when considering that Android doesn't provide such a facility (read-only address book).

    I'll leave this issue open as enhancement for further exploration.


  • developer

    It seems like there is a possibility to mark contacts as read-only (RAW_CONTACT_IS_READ_ONLY). As far as I have read, there's a sync-adapter called "Facebook" which creates read-only contacts using this field.

    So if the DAVdroid address book is read-only on the server, DAVdroid could also mark all contact as read-only locally.



  • DAVdroid knows that the address-book is read-only. It should avoid trying to upload any change to remote server, and just raise a warning "local modification of a read-only address-book".
    Even better: an option to discard local changes and revert to unmodified remote data.


Log in to reply
 

Looks like your connection to Bitfire App Forums was lost, please wait while we try to reconnect.