tilia-dav 3.1.0.pre.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.database.travis.yml +6 -0
- data/.gitignore +25 -0
- data/.rubocop.yml +35 -0
- data/.simplecov +4 -0
- data/.travis.yml +10 -0
- data/CHANGELOG.sabre.md +2084 -0
- data/CONTRIBUTING.md +25 -0
- data/Gemfile +25 -0
- data/Gemfile.lock +103 -0
- data/LICENSE +27 -0
- data/LICENSE.sabre +27 -0
- data/README.md +40 -0
- data/Rakefile +18 -0
- data/database.sample.yml +6 -0
- data/examples/minimal.rb +25 -0
- data/lib/tilia/cal_dav.rb +27 -0
- data/lib/tilia/cal_dav/backend.rb +17 -0
- data/lib/tilia/cal_dav/backend/abstract_backend.rb +194 -0
- data/lib/tilia/cal_dav/backend/backend_interface.rb +250 -0
- data/lib/tilia/cal_dav/backend/notification_support.rb +38 -0
- data/lib/tilia/cal_dav/backend/scheduling_support.rb +57 -0
- data/lib/tilia/cal_dav/backend/sequel.rb +1118 -0
- data/lib/tilia/cal_dav/backend/sharing_support.rb +239 -0
- data/lib/tilia/cal_dav/backend/subscription_support.rb +79 -0
- data/lib/tilia/cal_dav/backend/sync_support.rb +75 -0
- data/lib/tilia/cal_dav/calendar.rb +426 -0
- data/lib/tilia/cal_dav/calendar_home.rb +335 -0
- data/lib/tilia/cal_dav/calendar_object.rb +219 -0
- data/lib/tilia/cal_dav/calendar_query_validator.rb +294 -0
- data/lib/tilia/cal_dav/calendar_root.rb +57 -0
- data/lib/tilia/cal_dav/exception.rb +7 -0
- data/lib/tilia/cal_dav/exception/invalid_component_type.rb +21 -0
- data/lib/tilia/cal_dav/i_calendar.rb +11 -0
- data/lib/tilia/cal_dav/i_calendar_object.rb +13 -0
- data/lib/tilia/cal_dav/i_calendar_object_container.rb +32 -0
- data/lib/tilia/cal_dav/i_shareable_calendar.rb +40 -0
- data/lib/tilia/cal_dav/i_shared_calendar.rb +28 -0
- data/lib/tilia/cal_dav/ics_export_plugin.rb +327 -0
- data/lib/tilia/cal_dav/notifications.rb +12 -0
- data/lib/tilia/cal_dav/notifications/collection.rb +131 -0
- data/lib/tilia/cal_dav/notifications/i_collection.rb +17 -0
- data/lib/tilia/cal_dav/notifications/i_node.rb +30 -0
- data/lib/tilia/cal_dav/notifications/node.rb +142 -0
- data/lib/tilia/cal_dav/notifications/plugin.rb +138 -0
- data/lib/tilia/cal_dav/plugin.rb +891 -0
- data/lib/tilia/cal_dav/principal.rb +12 -0
- data/lib/tilia/cal_dav/principal/collection.rb +21 -0
- data/lib/tilia/cal_dav/principal/i_proxy_read.rb +13 -0
- data/lib/tilia/cal_dav/principal/i_proxy_write.rb +13 -0
- data/lib/tilia/cal_dav/principal/proxy_read.rb +127 -0
- data/lib/tilia/cal_dav/principal/proxy_write.rb +127 -0
- data/lib/tilia/cal_dav/principal/user.rb +96 -0
- data/lib/tilia/cal_dav/schedule.rb +14 -0
- data/lib/tilia/cal_dav/schedule/i_inbox.rb +12 -0
- data/lib/tilia/cal_dav/schedule/i_mip_plugin.rb +156 -0
- data/lib/tilia/cal_dav/schedule/i_outbox.rb +12 -0
- data/lib/tilia/cal_dav/schedule/i_scheduling_object.rb +10 -0
- data/lib/tilia/cal_dav/schedule/inbox.rb +211 -0
- data/lib/tilia/cal_dav/schedule/outbox.rb +143 -0
- data/lib/tilia/cal_dav/schedule/plugin.rb +851 -0
- data/lib/tilia/cal_dav/schedule/scheduling_object.rb +126 -0
- data/lib/tilia/cal_dav/shareable_calendar.rb +54 -0
- data/lib/tilia/cal_dav/shared_calendar.rb +120 -0
- data/lib/tilia/cal_dav/sharing_plugin.rb +359 -0
- data/lib/tilia/cal_dav/subscriptions.rb +9 -0
- data/lib/tilia/cal_dav/subscriptions/i_subscription.rb +37 -0
- data/lib/tilia/cal_dav/subscriptions/plugin.rb +83 -0
- data/lib/tilia/cal_dav/subscriptions/subscription.rb +205 -0
- data/lib/tilia/cal_dav/xml.rb +10 -0
- data/lib/tilia/cal_dav/xml/filter.rb +12 -0
- data/lib/tilia/cal_dav/xml/filter/calendar_data.rb +64 -0
- data/lib/tilia/cal_dav/xml/filter/comp_filter.rb +79 -0
- data/lib/tilia/cal_dav/xml/filter/param_filter.rb +66 -0
- data/lib/tilia/cal_dav/xml/filter/prop_filter.rb +80 -0
- data/lib/tilia/cal_dav/xml/notification.rb +13 -0
- data/lib/tilia/cal_dav/xml/notification/invite.rb +253 -0
- data/lib/tilia/cal_dav/xml/notification/invite_reply.rb +167 -0
- data/lib/tilia/cal_dav/xml/notification/notification_interface.rb +41 -0
- data/lib/tilia/cal_dav/xml/notification/system_status.rb +139 -0
- data/lib/tilia/cal_dav/xml/property.rb +15 -0
- data/lib/tilia/cal_dav/xml/property/allowed_sharing_modes.rb +64 -0
- data/lib/tilia/cal_dav/xml/property/email_address_set.rb +60 -0
- data/lib/tilia/cal_dav/xml/property/invite.rb +207 -0
- data/lib/tilia/cal_dav/xml/property/schedule_calendar_transp.rb +108 -0
- data/lib/tilia/cal_dav/xml/property/supported_calendar_component_set.rb +100 -0
- data/lib/tilia/cal_dav/xml/property/supported_calendar_data.rb +50 -0
- data/lib/tilia/cal_dav/xml/property/supported_collation_set.rb +47 -0
- data/lib/tilia/cal_dav/xml/request.rb +14 -0
- data/lib/tilia/cal_dav/xml/request/calendar_multi_get_report.rb +99 -0
- data/lib/tilia/cal_dav/xml/request/calendar_query_report.rb +112 -0
- data/lib/tilia/cal_dav/xml/request/free_busy_query_report.rb +70 -0
- data/lib/tilia/cal_dav/xml/request/invite_reply.rb +110 -0
- data/lib/tilia/cal_dav/xml/request/mk_calendar.rb +67 -0
- data/lib/tilia/cal_dav/xml/request/share.rb +93 -0
- data/lib/tilia/card_dav.rb +17 -0
- data/lib/tilia/card_dav/address_book.rb +338 -0
- data/lib/tilia/card_dav/address_book_home.rb +192 -0
- data/lib/tilia/card_dav/address_book_root.rb +58 -0
- data/lib/tilia/card_dav/backend.rb +12 -0
- data/lib/tilia/card_dav/backend/abstract_backend.rb +30 -0
- data/lib/tilia/card_dav/backend/backend_interface.rb +175 -0
- data/lib/tilia/card_dav/backend/sequel.rb +476 -0
- data/lib/tilia/card_dav/backend/sync_support.rb +80 -0
- data/lib/tilia/card_dav/card.rb +193 -0
- data/lib/tilia/card_dav/i_address_book.rb +10 -0
- data/lib/tilia/card_dav/i_card.rb +11 -0
- data/lib/tilia/card_dav/i_directory.rb +14 -0
- data/lib/tilia/card_dav/plugin.rb +724 -0
- data/lib/tilia/card_dav/vcf_export_plugin.rb +122 -0
- data/lib/tilia/card_dav/xml.rb +9 -0
- data/lib/tilia/card_dav/xml/filter.rb +11 -0
- data/lib/tilia/card_dav/xml/filter/address_data.rb +50 -0
- data/lib/tilia/card_dav/xml/filter/param_filter.rb +71 -0
- data/lib/tilia/card_dav/xml/filter/prop_filter.rb +77 -0
- data/lib/tilia/card_dav/xml/property.rb +10 -0
- data/lib/tilia/card_dav/xml/property/supported_address_data.rb +67 -0
- data/lib/tilia/card_dav/xml/property/supported_collation_set.rb +38 -0
- data/lib/tilia/card_dav/xml/request.rb +10 -0
- data/lib/tilia/card_dav/xml/request/address_book_multi_get_report.rb +91 -0
- data/lib/tilia/card_dav/xml/request/address_book_query_report.rb +156 -0
- data/lib/tilia/dav.rb +94 -0
- data/lib/tilia/dav/auth.rb +8 -0
- data/lib/tilia/dav/auth/backend.rb +15 -0
- data/lib/tilia/dav/auth/backend/abstract_basic.rb +119 -0
- data/lib/tilia/dav/auth/backend/abstract_digest.rb +132 -0
- data/lib/tilia/dav/auth/backend/apache.rb +85 -0
- data/lib/tilia/dav/auth/backend/backend_interface.rb +61 -0
- data/lib/tilia/dav/auth/backend/basic_call_back.rb +46 -0
- data/lib/tilia/dav/auth/backend/file.rb +61 -0
- data/lib/tilia/dav/auth/backend/sequel.rb +46 -0
- data/lib/tilia/dav/auth/plugin.rb +157 -0
- data/lib/tilia/dav/browser.rb +12 -0
- data/lib/tilia/dav/browser/assets/favicon.ico +0 -0
- data/lib/tilia/dav/browser/assets/openiconic/ICON-LICENSE +21 -0
- data/lib/tilia/dav/browser/assets/openiconic/open-iconic.css +510 -0
- data/lib/tilia/dav/browser/assets/openiconic/open-iconic.eot +0 -0
- data/lib/tilia/dav/browser/assets/openiconic/open-iconic.otf +0 -0
- data/lib/tilia/dav/browser/assets/openiconic/open-iconic.svg +543 -0
- data/lib/tilia/dav/browser/assets/openiconic/open-iconic.ttf +0 -0
- data/lib/tilia/dav/browser/assets/openiconic/open-iconic.woff +0 -0
- data/lib/tilia/dav/browser/assets/sabredav.css +228 -0
- data/lib/tilia/dav/browser/assets/sabredav.png +0 -0
- data/lib/tilia/dav/browser/guess_content_type.rb +80 -0
- data/lib/tilia/dav/browser/html_output.rb +27 -0
- data/lib/tilia/dav/browser/html_output_helper.rb +86 -0
- data/lib/tilia/dav/browser/map_get_to_prop_find.rb +41 -0
- data/lib/tilia/dav/browser/plugin.rb +693 -0
- data/lib/tilia/dav/browser/prop_find_all.rb +95 -0
- data/lib/tilia/dav/client.rb +341 -0
- data/lib/tilia/dav/collection.rb +79 -0
- data/lib/tilia/dav/core_plugin.rb +824 -0
- data/lib/tilia/dav/exception.rb +59 -0
- data/lib/tilia/dav/exception/bad_request.rb +18 -0
- data/lib/tilia/dav/exception/conflict.rb +18 -0
- data/lib/tilia/dav/exception/conflicting_lock.rb +26 -0
- data/lib/tilia/dav/exception/forbidden.rb +18 -0
- data/lib/tilia/dav/exception/insufficient_storage.rb +18 -0
- data/lib/tilia/dav/exception/invalid_resource_type.rb +23 -0
- data/lib/tilia/dav/exception/invalid_sync_token.rb +26 -0
- data/lib/tilia/dav/exception/length_required.rb +18 -0
- data/lib/tilia/dav/exception/lock_token_matches_request_uri.rb +25 -0
- data/lib/tilia/dav/exception/locked.rb +48 -0
- data/lib/tilia/dav/exception/method_not_allowed.rb +29 -0
- data/lib/tilia/dav/exception/not_authenticated.rb +18 -0
- data/lib/tilia/dav/exception/not_found.rb +18 -0
- data/lib/tilia/dav/exception/not_implemented.rb +18 -0
- data/lib/tilia/dav/exception/payment_required.rb +18 -0
- data/lib/tilia/dav/exception/precondition_failed.rb +47 -0
- data/lib/tilia/dav/exception/report_not_supported.rb +21 -0
- data/lib/tilia/dav/exception/requested_range_not_satisfiable.rb +18 -0
- data/lib/tilia/dav/exception/service_unavailable.rb +18 -0
- data/lib/tilia/dav/exception/too_many_matches.rb +21 -0
- data/lib/tilia/dav/exception/unsupported_media_type.rb +18 -0
- data/lib/tilia/dav/file.rb +58 -0
- data/lib/tilia/dav/fs.rb +9 -0
- data/lib/tilia/dav/fs/directory.rb +119 -0
- data/lib/tilia/dav/fs/file.rb +69 -0
- data/lib/tilia/dav/fs/node.rb +57 -0
- data/lib/tilia/dav/fs_ext.rb +8 -0
- data/lib/tilia/dav/fs_ext/directory.rb +175 -0
- data/lib/tilia/dav/fs_ext/file.rb +118 -0
- data/lib/tilia/dav/i_collection.rb +65 -0
- data/lib/tilia/dav/i_extended_collection.rb +36 -0
- data/lib/tilia/dav/i_file.rb +70 -0
- data/lib/tilia/dav/i_move_target.rb +37 -0
- data/lib/tilia/dav/i_multi_get.rb +29 -0
- data/lib/tilia/dav/i_node.rb +33 -0
- data/lib/tilia/dav/i_properties.rb +39 -0
- data/lib/tilia/dav/i_quota.rb +19 -0
- data/lib/tilia/dav/locks.rb +9 -0
- data/lib/tilia/dav/locks/backend.rb +12 -0
- data/lib/tilia/dav/locks/backend/abstract_backend.rb +16 -0
- data/lib/tilia/dav/locks/backend/backend_interface.rb +41 -0
- data/lib/tilia/dav/locks/backend/file.rb +146 -0
- data/lib/tilia/dav/locks/backend/sequel.rb +154 -0
- data/lib/tilia/dav/locks/lock_info.rb +60 -0
- data/lib/tilia/dav/locks/plugin.rb +467 -0
- data/lib/tilia/dav/mk_col.rb +47 -0
- data/lib/tilia/dav/mount.rb +7 -0
- data/lib/tilia/dav/mount/plugin.rb +62 -0
- data/lib/tilia/dav/node.rb +36 -0
- data/lib/tilia/dav/partial_update.rb +8 -0
- data/lib/tilia/dav/partial_update/i_patch_support.rb +40 -0
- data/lib/tilia/dav/partial_update/plugin.rb +179 -0
- data/lib/tilia/dav/prop_find.rb +262 -0
- data/lib/tilia/dav/prop_patch.rb +278 -0
- data/lib/tilia/dav/property_storage.rb +8 -0
- data/lib/tilia/dav/property_storage/backend.rb +10 -0
- data/lib/tilia/dav/property_storage/backend/backend_interface.rb +69 -0
- data/lib/tilia/dav/property_storage/backend/sequel.rb +192 -0
- data/lib/tilia/dav/property_storage/plugin.rb +131 -0
- data/lib/tilia/dav/server.rb +1388 -0
- data/lib/tilia/dav/server_plugin.rb +81 -0
- data/lib/tilia/dav/simple_collection.rb +71 -0
- data/lib/tilia/dav/simple_file.rb +82 -0
- data/lib/tilia/dav/string_util.rb +68 -0
- data/lib/tilia/dav/sync.rb +8 -0
- data/lib/tilia/dav/sync/i_sync_collection.rb +80 -0
- data/lib/tilia/dav/sync/plugin.rb +225 -0
- data/lib/tilia/dav/temporary_file_filter_plugin.rb +248 -0
- data/lib/tilia/dav/tree.rb +270 -0
- data/lib/tilia/dav/uuid_util.rb +45 -0
- data/lib/tilia/dav/version.rb +9 -0
- data/lib/tilia/dav/xml.rb +11 -0
- data/lib/tilia/dav/xml/element.rb +10 -0
- data/lib/tilia/dav/xml/element/prop.rb +92 -0
- data/lib/tilia/dav/xml/element/response.rb +188 -0
- data/lib/tilia/dav/xml/property.rb +16 -0
- data/lib/tilia/dav/xml/property/complex.rb +76 -0
- data/lib/tilia/dav/xml/property/get_last_modified.rb +79 -0
- data/lib/tilia/dav/xml/property/href.rb +137 -0
- data/lib/tilia/dav/xml/property/lock_discovery.rb +89 -0
- data/lib/tilia/dav/xml/property/resource_type.rb +96 -0
- data/lib/tilia/dav/xml/property/supported_lock.rb +48 -0
- data/lib/tilia/dav/xml/property/supported_method_set.rb +101 -0
- data/lib/tilia/dav/xml/property/supported_report_set.rb +118 -0
- data/lib/tilia/dav/xml/request.rb +13 -0
- data/lib/tilia/dav/xml/request/lock.rb +67 -0
- data/lib/tilia/dav/xml/request/mk_col.rb +69 -0
- data/lib/tilia/dav/xml/request/prop_find.rb +70 -0
- data/lib/tilia/dav/xml/request/prop_patch.rb +101 -0
- data/lib/tilia/dav/xml/request/sync_collection_report.rb +102 -0
- data/lib/tilia/dav/xml/response.rb +9 -0
- data/lib/tilia/dav/xml/response/multi_status.rb +108 -0
- data/lib/tilia/dav/xml/service.rb +42 -0
- data/lib/tilia/dav_acl.rb +16 -0
- data/lib/tilia/dav_acl/abstract_principal_collection.rb +143 -0
- data/lib/tilia/dav_acl/exception.rb +11 -0
- data/lib/tilia/dav_acl/exception/ace_conflict.rb +21 -0
- data/lib/tilia/dav_acl/exception/need_privileges.rb +65 -0
- data/lib/tilia/dav_acl/exception/no_abstract.rb +21 -0
- data/lib/tilia/dav_acl/exception/not_recognized_principal.rb +21 -0
- data/lib/tilia/dav_acl/exception/not_supported_privilege.rb +21 -0
- data/lib/tilia/dav_acl/fs.rb +9 -0
- data/lib/tilia/dav_acl/fs/collection.rb +108 -0
- data/lib/tilia/dav_acl/fs/file.rb +87 -0
- data/lib/tilia/dav_acl/fs/home_collection.rb +148 -0
- data/lib/tilia/dav_acl/i_acl.rb +61 -0
- data/lib/tilia/dav_acl/i_principal.rb +63 -0
- data/lib/tilia/dav_acl/i_principal_collection.rb +52 -0
- data/lib/tilia/dav_acl/plugin.rb +1109 -0
- data/lib/tilia/dav_acl/principal.rb +213 -0
- data/lib/tilia/dav_acl/principal_backend.rb +11 -0
- data/lib/tilia/dav_acl/principal_backend/abstract_backend.rb +42 -0
- data/lib/tilia/dav_acl/principal_backend/backend_interface.rb +127 -0
- data/lib/tilia/dav_acl/principal_backend/create_principal_support.rb +27 -0
- data/lib/tilia/dav_acl/principal_backend/sequel.rb +313 -0
- data/lib/tilia/dav_acl/principal_collection.rb +117 -0
- data/lib/tilia/dav_acl/xml.rb +8 -0
- data/lib/tilia/dav_acl/xml/property.rb +13 -0
- data/lib/tilia/dav_acl/xml/property/acl.rb +222 -0
- data/lib/tilia/dav_acl/xml/property/acl_restrictions.rb +40 -0
- data/lib/tilia/dav_acl/xml/property/current_user_privilege_set.rb +125 -0
- data/lib/tilia/dav_acl/xml/property/principal.rb +149 -0
- data/lib/tilia/dav_acl/xml/property/supported_privilege_set.rb +135 -0
- data/lib/tilia/dav_acl/xml/request.rb +11 -0
- data/lib/tilia/dav_acl/xml/request/expand_property_report.rb +86 -0
- data/lib/tilia/dav_acl/xml/request/principal_property_search_report.rb +111 -0
- data/lib/tilia/dav_acl/xml/request/principal_search_property_set_report.rb +49 -0
- data/test/cal_dav/backend/abstract_sequel_test.rb +817 -0
- data/test/cal_dav/backend/abstract_test.rb +163 -0
- data/test/cal_dav/backend/mock.rb +169 -0
- data/test/cal_dav/backend/mock_scheduling.rb +84 -0
- data/test/cal_dav/backend/mock_sharing.rb +124 -0
- data/test/cal_dav/backend/mock_subscription_support.rb +123 -0
- data/test/cal_dav/backend/sequel_my_sql_test.rb +102 -0
- data/test/cal_dav/backend/sequel_sqlite_test.rb +105 -0
- data/test/cal_dav/calendar_home_notifications_test.rb +41 -0
- data/test/cal_dav/calendar_home_shared_calendars_test.rb +64 -0
- data/test/cal_dav/calendar_home_subscriptions_test.rb +67 -0
- data/test/cal_dav/calendar_home_test.rb +144 -0
- data/test/cal_dav/calendar_object_test.rb +317 -0
- data/test/cal_dav/calendar_query_v_alarm_test.rb +114 -0
- data/test/cal_dav/calendar_query_validator_test.rb +820 -0
- data/test/cal_dav/calendar_test.rb +203 -0
- data/test/cal_dav/expand_events_double_events_test.rb +94 -0
- data/test/cal_dav/expand_events_dtstar_tand_dten_dby_day_test.rb +94 -0
- data/test/cal_dav/expand_events_dtstar_tand_dtend_test.rb +100 -0
- data/test/cal_dav/expand_events_floating_time_test.rb +211 -0
- data/test/cal_dav/free_busy_report_test.rb +156 -0
- data/test/cal_dav/get_events_by_timerange_test.rb +74 -0
- data/test/cal_dav/ics_export_plugin_test.rb +638 -0
- data/test/cal_dav/issue166_test.rb +59 -0
- data/test/cal_dav/issue172_test.rb +139 -0
- data/test/cal_dav/issue203_test.rb +130 -0
- data/test/cal_dav/issue205_test.rb +89 -0
- data/test/cal_dav/issue211_test.rb +84 -0
- data/test/cal_dav/issue220_test.rb +94 -0
- data/test/cal_dav/issue228_test.rb +74 -0
- data/test/cal_dav/j_cal_transform_test.rb +244 -0
- data/test/cal_dav/notifications/collection_test.rb +67 -0
- data/test/cal_dav/notifications/node_test.rb +73 -0
- data/test/cal_dav/notifications/plugin_test.rb +144 -0
- data/test/cal_dav/plugin_test.rb +1049 -0
- data/test/cal_dav/principal/collection_test.rb +19 -0
- data/test/cal_dav/principal/proxy_read_test.rb +67 -0
- data/test/cal_dav/principal/proxy_write_test.rb +29 -0
- data/test/cal_dav/principal/user_test.rb +91 -0
- data/test/cal_dav/schedule/deliver_new_event_test.rb +81 -0
- data/test/cal_dav/schedule/free_busy_request_test.rb +565 -0
- data/test/cal_dav/schedule/i_mip/mock_plugin.rb +40 -0
- data/test/cal_dav/schedule/i_mip_plugin_test.rb +196 -0
- data/test/cal_dav/schedule/inbox_test.rb +150 -0
- data/test/cal_dav/schedule/outbox_post_test.rb +124 -0
- data/test/cal_dav/schedule/outbox_test.rb +76 -0
- data/test/cal_dav/schedule/plugin_basic_test.rb +39 -0
- data/test/cal_dav/schedule/plugin_properties_test.rb +96 -0
- data/test/cal_dav/schedule/plugin_properties_with_shared_calendar_test.rb +69 -0
- data/test/cal_dav/schedule/schedule_deliver_test.rb +605 -0
- data/test/cal_dav/schedule/scheduling_object_test.rb +327 -0
- data/test/cal_dav/shareable_calendar_test.rb +58 -0
- data/test/cal_dav/shared_calendar_test.rb +189 -0
- data/test/cal_dav/sharing_plugin_test.rb +373 -0
- data/test/cal_dav/subscriptions/create_subscription_test.rb +115 -0
- data/test/cal_dav/subscriptions/plugin_test.rb +46 -0
- data/test/cal_dav/subscriptions/subscription_test.rb +119 -0
- data/test/cal_dav/test_util.rb +164 -0
- data/test/cal_dav/validate_i_cal_test.rb +219 -0
- data/test/cal_dav/xml/notification/invite_reply_test.rb +136 -0
- data/test/cal_dav/xml/notification/invite_test.rb +225 -0
- data/test/cal_dav/xml/notification/system_status_test.rb +63 -0
- data/test/cal_dav/xml/property/allowed_sharing_modes_test.rb +34 -0
- data/test/cal_dav/xml/property/email_address_set_test.rb +35 -0
- data/test/cal_dav/xml/property/invite_test.rb +173 -0
- data/test/cal_dav/xml/property/schedule_calendar_transp_test.rb +96 -0
- data/test/cal_dav/xml/property/supported_calendar_component_set_test.rb +76 -0
- data/test/cal_dav/xml/property/supported_calendar_data_test.rb +32 -0
- data/test/cal_dav/xml/property/supported_collation_set_test.rb +33 -0
- data/test/cal_dav/xml/request/calendar_query_report_test.rb +339 -0
- data/test/cal_dav/xml/request/invite_reply_test.rb +68 -0
- data/test/cal_dav/xml/request/share_test.rb +79 -0
- data/test/card_dav/abstract_plugin_test.rb +24 -0
- data/test/card_dav/address_book_home_test.rb +128 -0
- data/test/card_dav/address_book_query_test.rb +303 -0
- data/test/card_dav/address_book_root_test.rb +26 -0
- data/test/card_dav/address_book_test.rb +166 -0
- data/test/card_dav/backend/abstract_sequel_test.rb +302 -0
- data/test/card_dav/backend/mock.rb +122 -0
- data/test/card_dav/backend/sequel_my_sql_test.rb +56 -0
- data/test/card_dav/backend/sequel_sqlite_test.rb +59 -0
- data/test/card_dav/card_test.rb +164 -0
- data/test/card_dav/i_directory_test.rb +22 -0
- data/test/card_dav/multi_get_test.rb +97 -0
- data/test/card_dav/plugin_test.rb +87 -0
- data/test/card_dav/sogo_strip_content_type_test.rb +63 -0
- data/test/card_dav/test_util.rb +51 -0
- data/test/card_dav/validate_filter_test.rb +210 -0
- data/test/card_dav/validate_v_card_test.rb +143 -0
- data/test/card_dav/vcf_export_test.rb +66 -0
- data/test/card_dav/xml/property/supported_address_data_test.rb +34 -0
- data/test/card_dav/xml/property/supported_collation_set_test.rb +34 -0
- data/test/card_dav/xml/request/address_book_query_report_test.rb +276 -0
- data/test/dav/abstract_server.rb +36 -0
- data/test/dav/auth/backend/abstract_basic_test.rb +74 -0
- data/test/dav/auth/backend/abstract_digest_test.rb +114 -0
- data/test/dav/auth/backend/abstract_sequel_test.rb +25 -0
- data/test/dav/auth/backend/apache_test.rb +60 -0
- data/test/dav/auth/backend/basic_call_back_test.rb +33 -0
- data/test/dav/auth/backend/file_test.rb +43 -0
- data/test/dav/auth/backend/mock.rb +73 -0
- data/test/dav/auth/backend/sequel_my_sql_test.rb +32 -0
- data/test/dav/auth/backend/sequel_sqlite_test.rb +21 -0
- data/test/dav/auth/plugin_test.rb +92 -0
- data/test/dav/basic_node_test.rb +143 -0
- data/test/dav/browser/guess_content_type_test.rb +44 -0
- data/test/dav/browser/map_get_to_prop_find_test.rb +37 -0
- data/test/dav/browser/plugin_test.rb +165 -0
- data/test/dav/browser/prop_find_all_test.rb +59 -0
- data/test/dav/client_mock.rb +24 -0
- data/test/dav/client_test.rb +231 -0
- data/test/dav/copy_test.rb +33 -0
- data/test/dav/exception/locked_test.rb +61 -0
- data/test/dav/exception/payment_required_test.rb +14 -0
- data/test/dav/exception/service_unavailable_test.rb +14 -0
- data/test/dav/exception/too_many_matches_test.rb +31 -0
- data/test/dav/exception_test.rb +24 -0
- data/test/dav/fs_ext/file_test.rb +72 -0
- data/test/dav/fs_ext/server_test.rb +251 -0
- data/test/dav/get_if_conditions_test.rb +299 -0
- data/test/dav/http_delete_test.rb +110 -0
- data/test/dav/http_get_test.rb +130 -0
- data/test/dav/http_head_test.rb +80 -0
- data/test/dav/http_move_test.rb +105 -0
- data/test/dav/http_prefer_parsing_test.rb +186 -0
- data/test/dav/http_put_test.rb +271 -0
- data/test/dav/issue33_test.rb +90 -0
- data/test/dav/locks/backend/abstract_test.rb +160 -0
- data/test/dav/locks/backend/file_test.rb +24 -0
- data/test/dav/locks/backend/mock.rb +82 -0
- data/test/dav/locks/backend/sequel_my_sql_test.rb +32 -0
- data/test/dav/locks/backend/sequel_test.rb +19 -0
- data/test/dav/locks/ms_word_test.rb +119 -0
- data/test/dav/locks/plugin2_test.rb +61 -0
- data/test/dav/locks/plugin_test.rb +896 -0
- data/test/dav/mock/collection.rb +113 -0
- data/test/dav/mock/file.rb +100 -0
- data/test/dav/mock/properties_collection.rb +80 -0
- data/test/dav/mock/streaming_file.rb +66 -0
- data/test/dav/mount/plugin_test.rb +48 -0
- data/test/dav/object_tree_test.rb +65 -0
- data/test/dav/partial_update/file_mock.rb +92 -0
- data/test/dav/partial_update/plugin_test.rb +125 -0
- data/test/dav/partial_update/specification_test.rb +77 -0
- data/test/dav/prop_find_test.rb +87 -0
- data/test/dav/prop_patch_test.rb +367 -0
- data/test/dav/property_storage/backend/abstract_sequel_test.rb +147 -0
- data/test/dav/property_storage/backend/mock.rb +96 -0
- data/test/dav/property_storage/backend/sequel_mysql_test.rb +32 -0
- data/test/dav/property_storage/backend/sequel_sqlite_test.rb +31 -0
- data/test/dav/property_storage/plugin_test.rb +90 -0
- data/test/dav/server_copy_move_test.rb +164 -0
- data/test/dav/server_events_test.rb +105 -0
- data/test/dav/server_mkcol_test.rb +337 -0
- data/test/dav/server_mock.rb +10 -0
- data/test/dav/server_plugin_test.rb +85 -0
- data/test/dav/server_precondition_test.rb +253 -0
- data/test/dav/server_props_infinite_depth_test.rb +144 -0
- data/test/dav/server_props_test.rb +182 -0
- data/test/dav/server_range_test.rb +262 -0
- data/test/dav/server_simple_test.rb +388 -0
- data/test/dav/server_update_properties_test.rb +93 -0
- data/test/dav/simple_file_test.rb +17 -0
- data/test/dav/string_util_test.rb +92 -0
- data/test/dav/sync/mock_sync_collection.rb +141 -0
- data/test/dav/sync/plugin_test.rb +491 -0
- data/test/dav/sync_token_property_test.rb +105 -0
- data/test/dav/temporary_file_filter_test.rb +179 -0
- data/test/dav/test_plugin.rb +24 -0
- data/test/dav/tree_test.rb +201 -0
- data/test/dav/uuid_util_test.rb +14 -0
- data/test/dav/xml/element/prop_test.rb +121 -0
- data/test/dav/xml/element/response_test.rb +202 -0
- data/test/dav/xml/property/href_test.rb +112 -0
- data/test/dav/xml/property/last_modified_test.rb +52 -0
- data/test/dav/xml/property/lock_discovery_test.rb +79 -0
- data/test/dav/xml/property/supported_method_set_test.rb +54 -0
- data/test/dav/xml/property/supported_report_set_test.rb +109 -0
- data/test/dav/xml/request/prop_find_test.rb +45 -0
- data/test/dav/xml/request/prop_patch_test.rb +47 -0
- data/test/dav/xml/request/sync_collection_test.rb +89 -0
- data/test/dav/xml/xml_tester.rb +35 -0
- data/test/dav_acl/acl_method_test.rb +299 -0
- data/test/dav_acl/allow_access_test.rb +94 -0
- data/test/dav_acl/block_access_test.rb +161 -0
- data/test/dav_acl/exception/ace_conflict_test.rb +33 -0
- data/test/dav_acl/exception/need_privileges_exception_test.rb +43 -0
- data/test/dav_acl/exception/no_abstract_test.rb +33 -0
- data/test/dav_acl/exception/not_recognized_principal_test.rb +33 -0
- data/test/dav_acl/exception/not_supported_privilege_test.rb +33 -0
- data/test/dav_acl/expand_properties_test.rb +265 -0
- data/test/dav_acl/fs/collection_test.rb +39 -0
- data/test/dav_acl/fs/file_test.rb +47 -0
- data/test/dav_acl/fs/home_collection_test.rb +82 -0
- data/test/dav_acl/mock_acl_node.rb +27 -0
- data/test/dav_acl/mock_principal.rb +27 -0
- data/test/dav_acl/plugin_admin_test.rb +60 -0
- data/test/dav_acl/plugin_properties_test.rb +346 -0
- data/test/dav_acl/plugin_update_properties_test.rb +82 -0
- data/test/dav_acl/principal_backend/abstract_sequel_test.rb +159 -0
- data/test/dav_acl/principal_backend/mock.rb +150 -0
- data/test/dav_acl/principal_backend/sequel_my_sql_test.rb +43 -0
- data/test/dav_acl/principal_backend/sequel_sqlite_test.rb +31 -0
- data/test/dav_acl/principal_collection_test.rb +44 -0
- data/test/dav_acl/principal_property_search_test.rb +354 -0
- data/test/dav_acl/principal_search_property_set_test.rb +125 -0
- data/test/dav_acl/principal_test.rb +181 -0
- data/test/dav_acl/simple_plugin_test.rb +320 -0
- data/test/dav_acl/xml/property/acl_restrictions_test.rb +28 -0
- data/test/dav_acl/xml/property/acl_test.rb +325 -0
- data/test/dav_acl/xml/property/current_user_privilege_set_test.rb +77 -0
- data/test/dav_acl/xml/property/principal_test.rb +158 -0
- data/test/dav_acl/xml/property/supported_privilege_set_test.rb +109 -0
- data/test/dav_server_test.rb +225 -0
- data/test/http/response_mock.rb +16 -0
- data/test/http/sapi_mock.rb +29 -0
- data/test/test_helper.rb +176 -0
- data/tilia-dav.gemspec +28 -0
- metadata +726 -0
@@ -0,0 +1,239 @@
|
|
1
|
+
module Tilia
|
2
|
+
module CalDav
|
3
|
+
module Backend
|
4
|
+
# Adds support for sharing features to a CalDAV server.
|
5
|
+
#
|
6
|
+
# Note: This feature is experimental, and may change in between different
|
7
|
+
# SabreDAV versions.
|
8
|
+
#
|
9
|
+
# Early warning: Currently SabreDAV provides no implementation for this. This
|
10
|
+
# is, because in it's current state there is no elegant way to do this.
|
11
|
+
# The problem lies in the fact that a real CalDAV server with sharing support
|
12
|
+
# would first need email support (with invite notifications), and really also
|
13
|
+
# a browser-frontend that allows people to accept or reject these shares.
|
14
|
+
#
|
15
|
+
# In addition, the CalDAV backends are currently kept as independent as
|
16
|
+
# possible, and should not be aware of principals, email addresses or
|
17
|
+
# accounts.
|
18
|
+
#
|
19
|
+
# Adding an implementation for Sharing to standard-sabredav would contradict
|
20
|
+
# these goals, so for this reason this is currently not implemented, although
|
21
|
+
# it may very well in the future; but probably not before SabreDAV 2.0.
|
22
|
+
#
|
23
|
+
# The interface works however, so if you implement all this, and do it
|
24
|
+
# correctly sharing _will_ work. It's not particularly easy, and I _urge you_
|
25
|
+
# to make yourself acquainted with the following document first:
|
26
|
+
#
|
27
|
+
# https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-sharing.txt
|
28
|
+
#
|
29
|
+
# An overview
|
30
|
+
# ========
|
31
|
+
#
|
32
|
+
# Implementing this interface will allow a user to share his or her calendars
|
33
|
+
# to other users. Effectively, when a calendar is shared the calendar will
|
34
|
+
# show up in both the Sharer's and Sharee's calendar-home root.
|
35
|
+
# This interface adds a few methods that ensure that this happens, and there
|
36
|
+
# are also a number of new requirements in the base-class you must now follow.
|
37
|
+
#
|
38
|
+
#
|
39
|
+
# How it works
|
40
|
+
# ========
|
41
|
+
#
|
42
|
+
# When a user shares a calendar, the update_shares method will be called with
|
43
|
+
# a list of sharees that are now added, and a list of sharees that have been
|
44
|
+
# removed.
|
45
|
+
# Removal is instant, but when a sharee is added the sharee first gets a
|
46
|
+
# chance to accept or reject the invitation for a share.
|
47
|
+
#
|
48
|
+
# After a share is accepted, the calendar will be returned from
|
49
|
+
# getUserCalendars for both the sharer, and the sharee.
|
50
|
+
#
|
51
|
+
# If the sharee deletes the calendar, only their share gets deleted. When the
|
52
|
+
# owner deletes a calendar, it will be removed for everybody.
|
53
|
+
#
|
54
|
+
#
|
55
|
+
# Notifications
|
56
|
+
# =========
|
57
|
+
#
|
58
|
+
# During all these sharing operations, a lot of notifications are sent back
|
59
|
+
# and forward.
|
60
|
+
#
|
61
|
+
# Whenever the list of sharees for a calendar has been changed (they have been
|
62
|
+
# added, removed or modified) all sharees should get a notification for this
|
63
|
+
# change.
|
64
|
+
# This notification is always represented by:
|
65
|
+
#
|
66
|
+
# Sabre\CalDAV\Notifications\Notification\Invite
|
67
|
+
#
|
68
|
+
# In the case of an invite, the sharee may reply with an 'accept' or
|
69
|
+
# 'decline'. These are always represented by:
|
70
|
+
#
|
71
|
+
# Sabre\CalDAV\Notifications\Notification\InviteReply
|
72
|
+
#
|
73
|
+
#
|
74
|
+
# Calendar access by sharees
|
75
|
+
# ==================
|
76
|
+
#
|
77
|
+
# As mentioned earlier, shared calendars must now also be returned for
|
78
|
+
# getCalendarsForUser for sharees. A few things change though.
|
79
|
+
#
|
80
|
+
# The following properties must be specified:
|
81
|
+
#
|
82
|
+
# 1. {http://calendarserver.org/ns/}shared-url
|
83
|
+
#
|
84
|
+
# This property MUST contain the url to the original calendar, that is.. the
|
85
|
+
# path to the calendar from the owner.
|
86
|
+
#
|
87
|
+
# 2. {http://sabredav.org/ns}owner-principal
|
88
|
+
#
|
89
|
+
# This is a url to to the principal who is sharing the calendar.
|
90
|
+
#
|
91
|
+
# 3. {http://sabredav.org/ns}read-only
|
92
|
+
#
|
93
|
+
# This should be either 0 or 1, depending on if the user has read-only or
|
94
|
+
# read-write access to the calendar.
|
95
|
+
#
|
96
|
+
# Only when this is done, the calendar will correctly be marked as a calendar
|
97
|
+
# that's shared to him, thus allowing clients to display the correct interface
|
98
|
+
# and ACL enforcement.
|
99
|
+
#
|
100
|
+
# If a sharee deletes their calendar, only their instance of the calendar
|
101
|
+
# should be deleted, the original should still exists.
|
102
|
+
# Pretty much any 'dead' WebDAV properties on these shared calendars should be
|
103
|
+
# specific to a user. This means that if the displayname is changed by a
|
104
|
+
# sharee, the original is not affected. This is also true for:
|
105
|
+
# * The description
|
106
|
+
# * The color
|
107
|
+
# * The order
|
108
|
+
# * And any other dead properties.
|
109
|
+
#
|
110
|
+
# Properties like a ctag should not be different for multiple instances of the
|
111
|
+
# calendar.
|
112
|
+
#
|
113
|
+
# Lastly, objects *within* calendars should also have user-specific data. The
|
114
|
+
# two things that are user-specific are:
|
115
|
+
# * VALARM objects
|
116
|
+
# * The TRANSP property
|
117
|
+
#
|
118
|
+
# This _also_ implies that if a VALARM is deleted by a sharee for some event,
|
119
|
+
# this has no effect on the original VALARM.
|
120
|
+
#
|
121
|
+
# Understandably, the this last requirement is one of the hardest.
|
122
|
+
# Realisticly, I can see people ignoring this part of the spec, but that could
|
123
|
+
# cause a different set of issues.
|
124
|
+
#
|
125
|
+
#
|
126
|
+
# Publishing
|
127
|
+
# =======
|
128
|
+
#
|
129
|
+
# When a user publishes a url, the server should generate a 'publish url'.
|
130
|
+
# This is a read-only url, anybody can use to consume the calendar feed.
|
131
|
+
#
|
132
|
+
# Calendars are in one of two states:
|
133
|
+
# * published
|
134
|
+
# * unpublished
|
135
|
+
#
|
136
|
+
# If a calendar is published, the following property should be returned
|
137
|
+
# for each calendar in getCalendarsForUser.
|
138
|
+
#
|
139
|
+
# {http://calendarserver.org/ns/}publish-url
|
140
|
+
#
|
141
|
+
# This element should contain a {DAV:}href element, which points to the
|
142
|
+
# public url that does not require authentication. Unlike every other href,
|
143
|
+
# this url must be absolute.
|
144
|
+
#
|
145
|
+
# Ideally, the following property is always returned
|
146
|
+
#
|
147
|
+
# {http://calendarserver.org/ns/}pre-publish-url
|
148
|
+
#
|
149
|
+
# This property should contain the url that the calendar _would_ have, if it
|
150
|
+
# were to be published. iCal uses this to display the url, before the user
|
151
|
+
# will actually publish it.
|
152
|
+
#
|
153
|
+
#
|
154
|
+
# Selectively disabling publish or share feature
|
155
|
+
# ===============================
|
156
|
+
#
|
157
|
+
# If Sabre\CalDAV\Property\AllowedSharingModes is returned from
|
158
|
+
# getCalendarsForUser, this allows the server to specify whether either sharing,
|
159
|
+
# or publishing is supported.
|
160
|
+
#
|
161
|
+
# This allows a client to determine in advance which features are available,
|
162
|
+
# and update the interface appropriately. If this property is not returned by
|
163
|
+
# the backend, the SharingPlugin automatically injects it and assumes both
|
164
|
+
# features are available.
|
165
|
+
#
|
166
|
+
# @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
|
167
|
+
# @author Evert Pot (http://evertpot.com/)
|
168
|
+
# @license http://sabre.io/license/ Modified BSD License
|
169
|
+
module SharingSupport
|
170
|
+
include NotificationSupport
|
171
|
+
|
172
|
+
# Updates the list of shares.
|
173
|
+
#
|
174
|
+
# The first array is a list of people that are to be added to the
|
175
|
+
# calendar.
|
176
|
+
#
|
177
|
+
# Every element in the add array has the following properties:
|
178
|
+
# * href - A url. Usually a mailto: address
|
179
|
+
# * commonName - Usually a first and last name, or false
|
180
|
+
# * summary - A description of the share, can also be false
|
181
|
+
# * readOnly - A boolean value
|
182
|
+
#
|
183
|
+
# Every element in the remove array is just the address string.
|
184
|
+
#
|
185
|
+
# Note that if the calendar is currently marked as 'not shared' by and
|
186
|
+
# this method is called, the calendar should be 'upgraded' to a shared
|
187
|
+
# calendar.
|
188
|
+
#
|
189
|
+
# @param mixed calendar_id
|
190
|
+
# @param array add
|
191
|
+
# @param array remove
|
192
|
+
# @return void
|
193
|
+
def update_shares(calendar_id, add, remove)
|
194
|
+
end
|
195
|
+
|
196
|
+
# Returns the list of people whom this calendar is shared with.
|
197
|
+
#
|
198
|
+
# Every element in this array should have the following properties:
|
199
|
+
# * href - Often a mailto: address
|
200
|
+
# * commonName - Optional, for example a first + last name
|
201
|
+
# * status - See the Sabre\CalDAV\SharingPlugin::STATUS_ constants.
|
202
|
+
# * readOnly - boolean
|
203
|
+
# * summary - Optional, a description for the share
|
204
|
+
#
|
205
|
+
# This method may be called by either the original instance of the
|
206
|
+
# calendar, as well as the shared instances. In the case of the shared
|
207
|
+
# instances, it is perfectly acceptable to return an empty array in case
|
208
|
+
# there are privacy concerns.
|
209
|
+
#
|
210
|
+
# @param mixed calendar_id
|
211
|
+
# @return array
|
212
|
+
def shares(calendar_id)
|
213
|
+
end
|
214
|
+
|
215
|
+
# This method is called when a user replied to a request to share.
|
216
|
+
#
|
217
|
+
# If the user chose to accept the share, this method should return the
|
218
|
+
# newly created calendar url.
|
219
|
+
#
|
220
|
+
# @param string href The sharee who is replying (often a mailto: address)
|
221
|
+
# @param int status One of the SharingPlugin::STATUS_* constants
|
222
|
+
# @param string calendar_uri The url to the calendar thats being shared
|
223
|
+
# @param string in_reply_to The unique id this message is a response to
|
224
|
+
# @param string summary A description of the reply
|
225
|
+
# @return null|string
|
226
|
+
def share_reply(href, status, calendar_uri, in_reply_to, summary = nil)
|
227
|
+
end
|
228
|
+
|
229
|
+
# Publishes a calendar
|
230
|
+
#
|
231
|
+
# @param mixed calendar_id
|
232
|
+
# @param bool value
|
233
|
+
# @return void
|
234
|
+
def update_publish_status(calendar_id, value)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Tilia
|
2
|
+
module CalDav
|
3
|
+
module Backend
|
4
|
+
# Every CalDAV backend must at least implement this interface.
|
5
|
+
module SubscriptionSupport
|
6
|
+
include BackendInterface
|
7
|
+
|
8
|
+
# Returns a list of subscriptions for a principal.
|
9
|
+
#
|
10
|
+
# Every subscription is an array with the following keys:
|
11
|
+
# * id, a unique id that will be used by other functions to modify the
|
12
|
+
# subscription. This can be the same as the uri or a database key.
|
13
|
+
# * uri. This is just the 'base uri' or 'filename' of the subscription.
|
14
|
+
# * principaluri. The owner of the subscription. Almost always the same as
|
15
|
+
# principalUri passed to this method.
|
16
|
+
#
|
17
|
+
# Furthermore, all the subscription info must be returned too:
|
18
|
+
#
|
19
|
+
# 1. {DAV:}displayname
|
20
|
+
# 2. {http://apple.com/ns/ical/}refreshrate
|
21
|
+
# 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos
|
22
|
+
# should not be stripped).
|
23
|
+
# 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms
|
24
|
+
# should not be stripped).
|
25
|
+
# 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if
|
26
|
+
# attachments should not be stripped).
|
27
|
+
# 6. {http://calendarserver.org/ns/}source (Must be a
|
28
|
+
# Sabre\DAV\Property\Href).
|
29
|
+
# 7. {http://apple.com/ns/ical/}calendar-color
|
30
|
+
# 8. {http://apple.com/ns/ical/}calendar-order
|
31
|
+
# 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
|
32
|
+
# (should just be an instance of
|
33
|
+
# Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of
|
34
|
+
# default components).
|
35
|
+
#
|
36
|
+
# @param string principal_uri
|
37
|
+
# @return array
|
38
|
+
def subscriptions_for_user(principal_uri)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Creates a new subscription for a principal.
|
42
|
+
#
|
43
|
+
# If the creation was a success, an id must be returned that can be used to reference
|
44
|
+
# this subscription in other methods, such as updateSubscription.
|
45
|
+
#
|
46
|
+
# @param string principal_uri
|
47
|
+
# @param string uri
|
48
|
+
# @param array properties
|
49
|
+
# @return mixed
|
50
|
+
def create_subscription(principal_uri, uri, properties)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Updates a subscription
|
54
|
+
#
|
55
|
+
# The list of mutations is stored in a Sabre\DAV\PropPatch object.
|
56
|
+
# To do the actual updates, you must tell this object which properties
|
57
|
+
# you're going to process with the handle method.
|
58
|
+
#
|
59
|
+
# Calling the handle method is like telling the PropPatch object "I
|
60
|
+
# promise I can handle updating this property".
|
61
|
+
#
|
62
|
+
# Read the PropPatch documenation for more info and examples.
|
63
|
+
#
|
64
|
+
# @param mixed subscription_id
|
65
|
+
# @param \Sabre\DAV\PropPatch prop_patch
|
66
|
+
# @return void
|
67
|
+
def update_subscription(subscription_id, prop_patch)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Deletes a subscription.
|
71
|
+
#
|
72
|
+
# @param mixed subscription_id
|
73
|
+
# @return void
|
74
|
+
def delete_subscription(subscription_id)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Tilia
|
2
|
+
module CalDav
|
3
|
+
module Backend
|
4
|
+
# WebDAV-sync support for CalDAV backends.
|
5
|
+
#
|
6
|
+
# In order for backends to advertise support for WebDAV-sync, this interface
|
7
|
+
# must be implemented.
|
8
|
+
#
|
9
|
+
# Implementing this can result in a significant reduction of bandwidth and CPU
|
10
|
+
# time.
|
11
|
+
#
|
12
|
+
# For this to work, you _must_ return a {http://sabredav.org/ns}sync-token
|
13
|
+
# property from getCalendarsFromUser.
|
14
|
+
module SyncSupport
|
15
|
+
include BackendInterface
|
16
|
+
# The getChanges method returns all the changes that have happened, since
|
17
|
+
# the specified syncToken in the specified calendar.
|
18
|
+
#
|
19
|
+
# This function should return an array, such as the following:
|
20
|
+
#
|
21
|
+
# [
|
22
|
+
# 'syncToken' => 'The current synctoken',
|
23
|
+
# 'added' => [
|
24
|
+
# 'new.txt',
|
25
|
+
# ],
|
26
|
+
# 'modified' => [
|
27
|
+
# 'modified.txt',
|
28
|
+
# ],
|
29
|
+
# 'deleted' => [
|
30
|
+
# 'foo.php.bak',
|
31
|
+
# 'old.txt'
|
32
|
+
# ]
|
33
|
+
# )
|
34
|
+
#
|
35
|
+
# The returned syncToken property should reflect the *current* syncToken
|
36
|
+
# of the calendar, as reported in the {http://sabredav.org/ns}sync-token
|
37
|
+
# property This is * needed here too, to ensure the operation is atomic.
|
38
|
+
#
|
39
|
+
# If the sync_token argument is specified as null, this is an initial
|
40
|
+
# sync, and all members should be reported.
|
41
|
+
#
|
42
|
+
# The modified property is an array of nodenames that have changed since
|
43
|
+
# the last token.
|
44
|
+
#
|
45
|
+
# The deleted property is an array with nodenames, that have been deleted
|
46
|
+
# from collection.
|
47
|
+
#
|
48
|
+
# The sync_level argument is basically the 'depth' of the report. If it's
|
49
|
+
# 1, you only have to report changes that happened only directly in
|
50
|
+
# immediate descendants. If it's 2, it should also include changes from
|
51
|
+
# the nodes below the child collections. (grandchildren)
|
52
|
+
#
|
53
|
+
# The limit argument allows a client to specify how many results should
|
54
|
+
# be returned at most. If the limit is not specified, it should be treated
|
55
|
+
# as infinite.
|
56
|
+
#
|
57
|
+
# If the limit (infinite or not) is higher than you're willing to return,
|
58
|
+
# you should throw a Sabre\DAV\Exception\TooMuchMatches exception.
|
59
|
+
#
|
60
|
+
# If the syncToken is expired (due to data cleanup) or unknown, you must
|
61
|
+
# return null.
|
62
|
+
#
|
63
|
+
# The limit is 'suggestive'. You are free to ignore it.
|
64
|
+
#
|
65
|
+
# @param string calendar_id
|
66
|
+
# @param string sync_token
|
67
|
+
# @param int sync_level
|
68
|
+
# @param int limit
|
69
|
+
# @return array
|
70
|
+
def changes_for_calendar(calendar_id, sync_token, sync_level, limit = nil)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,426 @@
|
|
1
|
+
module Tilia
|
2
|
+
module CalDav
|
3
|
+
# This object represents a CalDAV calendar.
|
4
|
+
#
|
5
|
+
# A calendar can contain multiple TODO and or Events. These are represented
|
6
|
+
# as \Sabre\CalDAV\CalendarObject objects.
|
7
|
+
class Calendar
|
8
|
+
include ICalendar
|
9
|
+
include Dav::IProperties
|
10
|
+
include Dav::Sync::ISyncCollection
|
11
|
+
include Dav::IMultiGet
|
12
|
+
|
13
|
+
# @!attribute [r] calendar_info
|
14
|
+
# @!visibility private
|
15
|
+
# This is an array with calendar information
|
16
|
+
#
|
17
|
+
# @var array
|
18
|
+
|
19
|
+
# @!attribute [r] caldav_backend
|
20
|
+
# @!visibility private
|
21
|
+
# CalDAV backend
|
22
|
+
#
|
23
|
+
# @var Backend\BackendInterface
|
24
|
+
|
25
|
+
# Constructor
|
26
|
+
#
|
27
|
+
# @param Backend\BackendInterface caldav_backend
|
28
|
+
# @param array calendar_info
|
29
|
+
def initialize(caldav_backend, calendar_info)
|
30
|
+
@caldav_backend = caldav_backend
|
31
|
+
@calendar_info = calendar_info
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns the name of the calendar
|
35
|
+
#
|
36
|
+
# @return string
|
37
|
+
def name
|
38
|
+
@calendar_info['uri']
|
39
|
+
end
|
40
|
+
|
41
|
+
# Updates properties on this node.
|
42
|
+
#
|
43
|
+
# This method received a PropPatch object, which contains all the
|
44
|
+
# information about the update.
|
45
|
+
#
|
46
|
+
# To update specific properties, call the 'handle' method on this object.
|
47
|
+
# Read the PropPatch documentation for more information.
|
48
|
+
#
|
49
|
+
# @param PropPatch prop_patch
|
50
|
+
# @return void
|
51
|
+
def prop_patch(prop_patch)
|
52
|
+
@caldav_backend.update_calendar(@calendar_info['id'], prop_patch)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Returns the list of properties
|
56
|
+
#
|
57
|
+
# @param array requested_properties
|
58
|
+
# @return array
|
59
|
+
def properties(_requested_properties)
|
60
|
+
response = {}
|
61
|
+
|
62
|
+
@calendar_info.each do |prop_name, _prop_value|
|
63
|
+
response[prop_name] = @calendar_info[prop_name] if prop_name[0] == '{'
|
64
|
+
end
|
65
|
+
|
66
|
+
response
|
67
|
+
end
|
68
|
+
|
69
|
+
# Returns a calendar object
|
70
|
+
#
|
71
|
+
# The contained calendar objects are for example Events or Todo's.
|
72
|
+
#
|
73
|
+
# @param string name
|
74
|
+
# @return \Sabre\CalDAV\ICalendarObject
|
75
|
+
def child(name)
|
76
|
+
obj = @caldav_backend.calendar_object(@calendar_info['id'], name)
|
77
|
+
|
78
|
+
fail Dav::Exception::NotFound, 'Calendar object not found' unless obj
|
79
|
+
|
80
|
+
obj['acl'] = child_acl
|
81
|
+
|
82
|
+
CalendarObject.new(@caldav_backend, @calendar_info, obj)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Returns the full list of calendar objects
|
86
|
+
#
|
87
|
+
# @return array
|
88
|
+
def children
|
89
|
+
objs = @caldav_backend.calendar_objects(@calendar_info['id'])
|
90
|
+
|
91
|
+
children = []
|
92
|
+
objs.each do |obj|
|
93
|
+
obj['acl'] = child_acl
|
94
|
+
children << CalendarObject.new(@caldav_backend, @calendar_info, obj)
|
95
|
+
end
|
96
|
+
|
97
|
+
children
|
98
|
+
end
|
99
|
+
|
100
|
+
# This method receives a list of paths in it's first argument.
|
101
|
+
# It must return an array with Node objects.
|
102
|
+
#
|
103
|
+
# If any children are not found, you do not have to return them.
|
104
|
+
#
|
105
|
+
# @param string[] paths
|
106
|
+
# @return array
|
107
|
+
def multiple_children(paths)
|
108
|
+
objs = @caldav_backend.multiple_calendar_objects(@calendar_info['id'], paths)
|
109
|
+
|
110
|
+
children = []
|
111
|
+
objs.each do |obj|
|
112
|
+
obj['acl'] = child_acl
|
113
|
+
children << CalendarObject.new(@caldav_backend, @calendar_info, obj)
|
114
|
+
end
|
115
|
+
|
116
|
+
children
|
117
|
+
end
|
118
|
+
|
119
|
+
# Checks if a child-node exists.
|
120
|
+
#
|
121
|
+
# @param string name
|
122
|
+
# @return bool
|
123
|
+
def child_exists(name)
|
124
|
+
obj = @caldav_backend.calendar_object(@calendar_info['id'], name)
|
125
|
+
|
126
|
+
if !obj
|
127
|
+
return false
|
128
|
+
else
|
129
|
+
return true
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# Creates a new directory
|
134
|
+
#
|
135
|
+
# We actually block this, as subdirectories are not allowed in calendars.
|
136
|
+
#
|
137
|
+
# @param string name
|
138
|
+
# @return void
|
139
|
+
def create_directory(_name)
|
140
|
+
fail Dav::Exception::MethodNotAllowed, 'Creating collections in calendar objects is not allowed'
|
141
|
+
end
|
142
|
+
|
143
|
+
# Creates a new file
|
144
|
+
#
|
145
|
+
# The contents of the new file must be a valid ICalendar string.
|
146
|
+
#
|
147
|
+
# @param string name
|
148
|
+
# @param resource calendar_data
|
149
|
+
# @return string|null
|
150
|
+
def create_file(name, calendar_data = nil)
|
151
|
+
calendar_data = calendar_data.read unless calendar_data.is_a?(String)
|
152
|
+
|
153
|
+
@caldav_backend.create_calendar_object(@calendar_info['id'], name, calendar_data)
|
154
|
+
end
|
155
|
+
|
156
|
+
# Deletes the calendar.
|
157
|
+
#
|
158
|
+
# @return void
|
159
|
+
def delete
|
160
|
+
@caldav_backend.delete_calendar(@calendar_info['id'])
|
161
|
+
end
|
162
|
+
|
163
|
+
# Renames the calendar. Note that most calendars use the
|
164
|
+
# {DAV:}displayname to display a name to display a name.
|
165
|
+
#
|
166
|
+
# @param string new_name
|
167
|
+
# @return void
|
168
|
+
def name=(_new_name)
|
169
|
+
fail Dav::Exception::MethodNotAllowed, 'Renaming calendars is not yet supported'
|
170
|
+
end
|
171
|
+
|
172
|
+
# Returns the last modification date as a unix timestamp.
|
173
|
+
#
|
174
|
+
# @return void
|
175
|
+
def last_modified
|
176
|
+
nil
|
177
|
+
end
|
178
|
+
|
179
|
+
# Returns the owner principal
|
180
|
+
#
|
181
|
+
# This must be a url to a principal, or null if there's no owner
|
182
|
+
#
|
183
|
+
# @return string|null
|
184
|
+
def owner
|
185
|
+
@calendar_info['principaluri']
|
186
|
+
end
|
187
|
+
|
188
|
+
# Returns a group principal
|
189
|
+
#
|
190
|
+
# This must be a url to a principal, or null if there's no owner
|
191
|
+
#
|
192
|
+
# @return string|null
|
193
|
+
def group
|
194
|
+
nil
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns a list of ACE's for this node.
|
198
|
+
#
|
199
|
+
# Each ACE has the following properties:
|
200
|
+
# * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
|
201
|
+
# currently the only supported privileges
|
202
|
+
# * 'principal', a url to the principal who owns the node
|
203
|
+
# * 'protected' (optional), indicating that this ACE is not allowed to
|
204
|
+
# be updated.
|
205
|
+
#
|
206
|
+
# @return array
|
207
|
+
def acl
|
208
|
+
acl = [
|
209
|
+
{
|
210
|
+
'privilege' => '{DAV:}read',
|
211
|
+
'principal' => owner,
|
212
|
+
'protected' => true
|
213
|
+
},
|
214
|
+
{
|
215
|
+
'privilege' => '{DAV:}read',
|
216
|
+
'principal' => owner + '/calendar-proxy-write',
|
217
|
+
'protected' => true
|
218
|
+
},
|
219
|
+
{
|
220
|
+
'privilege' => '{DAV:}read',
|
221
|
+
'principal' => owner + '/calendar-proxy-read',
|
222
|
+
'protected' => true
|
223
|
+
},
|
224
|
+
{
|
225
|
+
'privilege' => "{#{Plugin::NS_CALDAV}}read-free-busy",
|
226
|
+
'principal' => '{DAV:}authenticated',
|
227
|
+
'protected' => true
|
228
|
+
}
|
229
|
+
|
230
|
+
]
|
231
|
+
unless @calendar_info['{http://sabredav.org/ns}read-only']
|
232
|
+
acl << {
|
233
|
+
'privilege' => '{DAV:}write',
|
234
|
+
'principal' => owner,
|
235
|
+
'protected' => true
|
236
|
+
}
|
237
|
+
acl << {
|
238
|
+
'privilege' => '{DAV:}write',
|
239
|
+
'principal' => owner + '/calendar-proxy-write',
|
240
|
+
'protected' => true
|
241
|
+
}
|
242
|
+
end
|
243
|
+
|
244
|
+
acl
|
245
|
+
end
|
246
|
+
|
247
|
+
# This method returns the ACL's for calendar objects in this calendar.
|
248
|
+
# The result of this method automatically gets passed to the
|
249
|
+
# calendar-object nodes in the calendar.
|
250
|
+
#
|
251
|
+
# @return array
|
252
|
+
def child_acl
|
253
|
+
acl = [
|
254
|
+
{
|
255
|
+
'privilege' => '{DAV:}read',
|
256
|
+
'principal' => owner,
|
257
|
+
'protected' => true
|
258
|
+
},
|
259
|
+
{
|
260
|
+
'privilege' => '{DAV:}read',
|
261
|
+
'principal' => owner + '/calendar-proxy-write',
|
262
|
+
'protected' => true
|
263
|
+
},
|
264
|
+
{
|
265
|
+
'privilege' => '{DAV:}read',
|
266
|
+
'principal' => owner + '/calendar-proxy-read',
|
267
|
+
'protected' => true
|
268
|
+
}
|
269
|
+
|
270
|
+
]
|
271
|
+
unless @calendar_info['{http://sabredav.org/ns}read-only']
|
272
|
+
acl << {
|
273
|
+
'privilege' => '{DAV:}write',
|
274
|
+
'principal' => owner,
|
275
|
+
'protected' => true
|
276
|
+
}
|
277
|
+
acl << {
|
278
|
+
'privilege' => '{DAV:}write',
|
279
|
+
'principal' => owner + '/calendar-proxy-write',
|
280
|
+
'protected' => true
|
281
|
+
}
|
282
|
+
end
|
283
|
+
|
284
|
+
acl
|
285
|
+
end
|
286
|
+
|
287
|
+
# Updates the ACL
|
288
|
+
#
|
289
|
+
# This method will receive a list of new ACE's.
|
290
|
+
#
|
291
|
+
# @param array acl
|
292
|
+
# @return void
|
293
|
+
def acl=(_acl)
|
294
|
+
fail Dav::Exception::MethodNotAllowed, 'Changing ACL is not yet supported'
|
295
|
+
end
|
296
|
+
|
297
|
+
# Returns the list of supported privileges for this node.
|
298
|
+
#
|
299
|
+
# The returned data structure is a list of nested privileges.
|
300
|
+
# See \Sabre\DAVACL\Plugin::getDefaultSupportedPrivilegeSet for a simple
|
301
|
+
# standard structure.
|
302
|
+
#
|
303
|
+
# If null is returned from this method, the default privilege set is used,
|
304
|
+
# which is fine for most common usecases.
|
305
|
+
#
|
306
|
+
# @return array|null
|
307
|
+
def supported_privilege_set
|
308
|
+
default = DavAcl::Plugin.default_supported_privilege_set
|
309
|
+
|
310
|
+
# We need to inject 'read-free-busy' in the tree, aggregated under
|
311
|
+
# {DAV:}read.
|
312
|
+
default['aggregates'].each do |agg|
|
313
|
+
next unless agg['privilege'] == '{DAV:}read'
|
314
|
+
|
315
|
+
agg['aggregates'] << {
|
316
|
+
'privilege' => "{#{Plugin::NS_CALDAV}}read-free-busy"
|
317
|
+
}
|
318
|
+
end
|
319
|
+
|
320
|
+
default
|
321
|
+
end
|
322
|
+
|
323
|
+
# Performs a calendar-query on the contents of this calendar.
|
324
|
+
#
|
325
|
+
# The calendar-query is defined in RFC4791 : CalDAV. Using the
|
326
|
+
# calendar-query it is possible for a client to request a specific set of
|
327
|
+
# object, based on contents of iCalendar properties, date-ranges and
|
328
|
+
# iCalendar component types (VTODO, VEVENT).
|
329
|
+
#
|
330
|
+
# This method should just return a list of (relative) urls that match this
|
331
|
+
# query.
|
332
|
+
#
|
333
|
+
# The list of filters are specified as an array. The exact array is
|
334
|
+
# documented by Sabre\CalDAV\CalendarQueryParser.
|
335
|
+
#
|
336
|
+
# @param array filters
|
337
|
+
# @return array
|
338
|
+
def calendar_query(filters)
|
339
|
+
@caldav_backend.calendar_query(@calendar_info['id'], filters)
|
340
|
+
end
|
341
|
+
|
342
|
+
# This method returns the current sync-token for this collection.
|
343
|
+
# This can be any string.
|
344
|
+
#
|
345
|
+
# If null is returned from this function, the plugin assumes there's no
|
346
|
+
# sync information available.
|
347
|
+
#
|
348
|
+
# @return string|null
|
349
|
+
def sync_token
|
350
|
+
if @caldav_backend.is_a?(Backend::SyncSupport) &&
|
351
|
+
@calendar_info.key?('{DAV:}sync-token')
|
352
|
+
return @calendar_info['{DAV:}sync-token']
|
353
|
+
end
|
354
|
+
|
355
|
+
if @caldav_backend.is_a?(Backend::SyncSupport) &&
|
356
|
+
@calendar_info.key?('{http://sabredav.org/ns}sync-token')
|
357
|
+
return @calendar_info['{http://sabredav.org/ns}sync-token']
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
# The getChanges method returns all the changes that have happened, since
|
362
|
+
# the specified syncToken and the current collection.
|
363
|
+
#
|
364
|
+
# This function should return an array, such as the following:
|
365
|
+
#
|
366
|
+
# [
|
367
|
+
# 'syncToken' => 'The current synctoken',
|
368
|
+
# 'added' => [
|
369
|
+
# 'new.txt',
|
370
|
+
# ],
|
371
|
+
# 'modified' => [
|
372
|
+
# 'modified.txt',
|
373
|
+
# ],
|
374
|
+
# 'deleted' => [
|
375
|
+
# 'foo.php.bak',
|
376
|
+
# 'old.txt'
|
377
|
+
# ]
|
378
|
+
# ]
|
379
|
+
#
|
380
|
+
# The syncToken property should reflect the *current* syncToken of the
|
381
|
+
# collection, as reported get_sync_token. This is needed here too, to
|
382
|
+
# ensure the operation is atomic.
|
383
|
+
#
|
384
|
+
# If the syncToken is specified as null, this is an initial sync, and all
|
385
|
+
# members should be reported.
|
386
|
+
#
|
387
|
+
# The modified property is an array of nodenames that have changed since
|
388
|
+
# the last token.
|
389
|
+
#
|
390
|
+
# The deleted property is an array with nodenames, that have been deleted
|
391
|
+
# from collection.
|
392
|
+
#
|
393
|
+
# The second argument is basically the 'depth' of the report. If it's 1,
|
394
|
+
# you only have to report changes that happened only directly in immediate
|
395
|
+
# descendants. If it's 2, it should also include changes from the nodes
|
396
|
+
# below the child collections. (grandchildren)
|
397
|
+
#
|
398
|
+
# The third (optional) argument allows a client to specify how many
|
399
|
+
# results should be returned at most. If the limit is not specified, it
|
400
|
+
# should be treated as infinite.
|
401
|
+
#
|
402
|
+
# If the limit (infinite or not) is higher than you're willing to return,
|
403
|
+
# you should throw a Sabre\DAV\Exception\TooMuchMatches exception.
|
404
|
+
#
|
405
|
+
# If the syncToken is expired (due to data cleanup) or unknown, you must
|
406
|
+
# return null.
|
407
|
+
#
|
408
|
+
# The limit is 'suggestive'. You are free to ignore it.
|
409
|
+
#
|
410
|
+
# @param string sync_token
|
411
|
+
# @param int sync_level
|
412
|
+
# @param int limit
|
413
|
+
# @return array
|
414
|
+
def changes(sync_token, sync_level, limit = nil)
|
415
|
+
return nil unless @caldav_backend.is_a?(Backend::SyncSupport)
|
416
|
+
|
417
|
+
@caldav_backend.changes_for_calendar(
|
418
|
+
@calendar_info['id'],
|
419
|
+
sync_token,
|
420
|
+
sync_level,
|
421
|
+
limit
|
422
|
+
)
|
423
|
+
end
|
424
|
+
end
|
425
|
+
end
|
426
|
+
end
|