tilia-dav 3.1.0.pre.alpha6 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.sabre.md +97 -1
- data/Gemfile +1 -16
- data/Gemfile.lock +44 -41
- data/LICENSE +1 -1
- data/LICENSE.sabre +1 -1
- data/examples/addressbookserver.rb +52 -0
- data/examples/calendarserver.rb +58 -0
- data/examples/fileserver.rb +57 -0
- data/examples/groupwareserver.rb +69 -0
- data/examples/sql/mysql.addressbook.sql +28 -0
- data/examples/sql/mysql.calendars.sql +64 -0
- data/examples/sql/mysql.locks.sql +13 -0
- data/examples/sql/mysql.principals.sql +21 -0
- data/examples/sql/mysql.propertystorage.sql +8 -0
- data/examples/sql/mysql.users.sql +9 -0
- data/examples/sql/pgsql.addressbook.sql +52 -0
- data/examples/sql/pgsql.calendars.sql +93 -0
- data/examples/sql/pgsql.locks.sql +19 -0
- data/examples/sql/pgsql.principals.sql +38 -0
- data/examples/sql/pgsql.propertystorage.sql +13 -0
- data/examples/sql/pgsql.users.sql +14 -0
- data/examples/sql/sqlite.addressbooks.sql +28 -0
- data/examples/sql/sqlite.calendars.sql +64 -0
- data/examples/sql/sqlite.locks.sql +12 -0
- data/examples/sql/sqlite.principals.sql +20 -0
- data/examples/sql/sqlite.propertystorage.sql +10 -0
- data/examples/sql/sqlite.users.sql +9 -0
- data/lib/tilia/cal_dav/ics_export_plugin.rb +1 -1
- data/lib/tilia/cal_dav/plugin.rb +27 -11
- data/lib/tilia/cal_dav/schedule/i_mip_plugin.rb +2 -2
- data/lib/tilia/cal_dav/schedule/plugin.rb +7 -0
- data/lib/tilia/dav/auth/backend.rb +1 -0
- data/lib/tilia/dav/auth/backend/abstract_basic.rb +3 -2
- data/lib/tilia/dav/auth/backend/abstract_bearer.rb +116 -0
- data/lib/tilia/dav/auth/backend/abstract_digest.rb +3 -2
- data/lib/tilia/dav/auth/backend/apache.rb +2 -1
- data/lib/tilia/dav/auth/backend/sequel.rb +2 -9
- data/lib/tilia/dav/client.rb +29 -3
- data/lib/tilia/dav/core_plugin.rb +1 -2
- data/lib/tilia/dav/server.rb +16 -4
- data/lib/tilia/dav/temporary_file_filter_plugin.rb +3 -0
- data/lib/tilia/dav/tree.rb +4 -3
- data/lib/tilia/dav/version.rb +1 -1
- data/lib/tilia/dav/xml/element/response.rb +20 -2
- data/lib/tilia/dav_acl/principal_backend/sequel.rb +50 -6
- data/test/cal_dav/ics_export_plugin_test.rb +1 -0
- data/test/cal_dav/plugin_test.rb +4 -4
- data/test/cal_dav/schedule/plugin_properties_test.rb +51 -0
- data/test/card_dav/backend/sequel_my_sql_test.rb +3 -3
- data/test/card_dav/vcf_export_test.rb +11 -1
- data/test/dav/auth/backend/abstract_bearer_test.rb +71 -0
- data/test/dav/client_test.rb +42 -4
- data/test/dav/core_plugin_test.rb +12 -0
- data/test/dav/fs_ext/server_test.rb +1 -1
- data/test/dav/http_copy_test.rb +185 -0
- data/test/dav/mock/collection.rb +6 -9
- data/test/dav/mock/file.rb +10 -9
- data/test/dav/mock/streaming_file.rb +1 -3
- data/test/dav/server_events_test.rb +8 -6
- data/test/dav/server_range_test.rb +135 -155
- data/test/dav/server_simple_test.rb +14 -0
- data/test/dav/xml/element/response_test.rb +56 -1
- data/test/dav/xml/property/href_test.rb +14 -0
- data/test/dav_acl/principal_backend/abstract_sequel_test.rb +16 -0
- data/test/dav_acl/principal_backend/mock.rb +1 -1
- data/test/dav_server_test.rb +1 -1
- data/tilia-dav.gemspec +2 -2
- metadata +38 -14
- data/test/dav/copy_test.rb +0 -33
- data/test/dav/server_copy_move_test.rb +0 -164
@@ -24,6 +24,20 @@ XML
|
|
24
24
|
assert_xml_equal(expected, xml)
|
25
25
|
end
|
26
26
|
|
27
|
+
def test_serialize_space
|
28
|
+
href = Href.new('path alsopath')
|
29
|
+
assert_equal('path alsopath', href.href)
|
30
|
+
|
31
|
+
@context_uri = '/bla/'
|
32
|
+
xml = write('{DAV:}anything' => href)
|
33
|
+
|
34
|
+
expected = <<XML
|
35
|
+
<?xml version="1.0"?>
|
36
|
+
<d:anything xmlns:d="DAV:"><d:href>/bla/path alsopath</d:href></d:anything>
|
37
|
+
XML
|
38
|
+
assert_xml_equal(expected, xml)
|
39
|
+
end
|
40
|
+
|
27
41
|
def test_serialize_no_prefix
|
28
42
|
href = Tilia::Dav::Xml::Property::Href.new('path', false)
|
29
43
|
assert_equal('path', href.href)
|
@@ -153,6 +153,22 @@ module Tilia
|
|
153
153
|
backend.principal_by_path('principals/user')
|
154
154
|
)
|
155
155
|
end
|
156
|
+
|
157
|
+
def test_find_by_uri_unknown_scheme
|
158
|
+
db = sequel
|
159
|
+
backend = Sequel.new(db)
|
160
|
+
assert_nil(backend.find_by_uri('http://foo', 'principals'))
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_find_by_uri
|
164
|
+
db = sequel
|
165
|
+
backend = Sequel.new(db)
|
166
|
+
|
167
|
+
assert_equal(
|
168
|
+
'principals/user',
|
169
|
+
backend.find_by_uri('mailto:user@example.org', 'principals')
|
170
|
+
)
|
171
|
+
end
|
156
172
|
end
|
157
173
|
end
|
158
174
|
end
|
data/test/dav_server_test.rb
CHANGED
data/tilia-dav.gemspec
CHANGED
@@ -10,14 +10,14 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.files = `git ls-files`.split("\n")
|
11
11
|
s.homepage = 'https://github.com/tilia/tilia-dav'
|
12
12
|
|
13
|
-
s.add_runtime_dependency 'tilia-vobject', '
|
13
|
+
s.add_runtime_dependency 'tilia-vobject', '~> 4.0.2'
|
14
14
|
s.add_runtime_dependency 'tilia-event', '~> 2.0'
|
15
15
|
s.add_runtime_dependency 'tilia-xml', '~> 1.2'
|
16
16
|
s.add_runtime_dependency 'tilia-http', '~> 4.1'
|
17
17
|
s.add_runtime_dependency 'tilia-uri', '~> 1.0'
|
18
18
|
|
19
19
|
# External dependencies
|
20
|
-
s.add_runtime_dependency 'activesupport', '
|
20
|
+
s.add_runtime_dependency 'activesupport', '>= 4.0'
|
21
21
|
s.add_runtime_dependency 'sys-filesystem', '~> 1.1'
|
22
22
|
s.add_runtime_dependency 'sequel', '~> 4.29'
|
23
23
|
s.add_runtime_dependency 'sqlite3', '~> 1.3'
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tilia-dav
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakob Sack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tilia-vobject
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.0.
|
19
|
+
version: 4.0.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.0.
|
26
|
+
version: 4.0.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: tilia-event
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: activesupport
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '4.
|
89
|
+
version: '4.0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '4.
|
96
|
+
version: '4.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: sys-filesystem
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -215,7 +215,29 @@ files:
|
|
215
215
|
- README.md
|
216
216
|
- Rakefile
|
217
217
|
- database.sample.yml
|
218
|
+
- examples/addressbookserver.rb
|
219
|
+
- examples/calendarserver.rb
|
220
|
+
- examples/fileserver.rb
|
221
|
+
- examples/groupwareserver.rb
|
218
222
|
- examples/minimal.rb
|
223
|
+
- examples/sql/mysql.addressbook.sql
|
224
|
+
- examples/sql/mysql.calendars.sql
|
225
|
+
- examples/sql/mysql.locks.sql
|
226
|
+
- examples/sql/mysql.principals.sql
|
227
|
+
- examples/sql/mysql.propertystorage.sql
|
228
|
+
- examples/sql/mysql.users.sql
|
229
|
+
- examples/sql/pgsql.addressbook.sql
|
230
|
+
- examples/sql/pgsql.calendars.sql
|
231
|
+
- examples/sql/pgsql.locks.sql
|
232
|
+
- examples/sql/pgsql.principals.sql
|
233
|
+
- examples/sql/pgsql.propertystorage.sql
|
234
|
+
- examples/sql/pgsql.users.sql
|
235
|
+
- examples/sql/sqlite.addressbooks.sql
|
236
|
+
- examples/sql/sqlite.calendars.sql
|
237
|
+
- examples/sql/sqlite.locks.sql
|
238
|
+
- examples/sql/sqlite.principals.sql
|
239
|
+
- examples/sql/sqlite.propertystorage.sql
|
240
|
+
- examples/sql/sqlite.users.sql
|
219
241
|
- lib/tilia/cal_dav.rb
|
220
242
|
- lib/tilia/cal_dav/backend.rb
|
221
243
|
- lib/tilia/cal_dav/backend/abstract_backend.rb
|
@@ -325,6 +347,7 @@ files:
|
|
325
347
|
- lib/tilia/dav/auth.rb
|
326
348
|
- lib/tilia/dav/auth/backend.rb
|
327
349
|
- lib/tilia/dav/auth/backend/abstract_basic.rb
|
350
|
+
- lib/tilia/dav/auth/backend/abstract_bearer.rb
|
328
351
|
- lib/tilia/dav/auth/backend/abstract_digest.rb
|
329
352
|
- lib/tilia/dav/auth/backend/apache.rb
|
330
353
|
- lib/tilia/dav/auth/backend/backend_interface.rb
|
@@ -575,6 +598,7 @@ files:
|
|
575
598
|
- test/card_dav/xml/request/address_book_query_report_test.rb
|
576
599
|
- test/dav/abstract_server.rb
|
577
600
|
- test/dav/auth/backend/abstract_basic_test.rb
|
601
|
+
- test/dav/auth/backend/abstract_bearer_test.rb
|
578
602
|
- test/dav/auth/backend/abstract_digest_test.rb
|
579
603
|
- test/dav/auth/backend/abstract_sequel_test.rb
|
580
604
|
- test/dav/auth/backend/apache_test.rb
|
@@ -591,7 +615,7 @@ files:
|
|
591
615
|
- test/dav/browser/prop_find_all_test.rb
|
592
616
|
- test/dav/client_mock.rb
|
593
617
|
- test/dav/client_test.rb
|
594
|
-
- test/dav/
|
618
|
+
- test/dav/core_plugin_test.rb
|
595
619
|
- test/dav/exception/locked_test.rb
|
596
620
|
- test/dav/exception/payment_required_test.rb
|
597
621
|
- test/dav/exception/service_unavailable_test.rb
|
@@ -600,6 +624,7 @@ files:
|
|
600
624
|
- test/dav/fs_ext/file_test.rb
|
601
625
|
- test/dav/fs_ext/server_test.rb
|
602
626
|
- test/dav/get_if_conditions_test.rb
|
627
|
+
- test/dav/http_copy_test.rb
|
603
628
|
- test/dav/http_delete_test.rb
|
604
629
|
- test/dav/http_get_test.rb
|
605
630
|
- test/dav/http_head_test.rb
|
@@ -631,7 +656,6 @@ files:
|
|
631
656
|
- test/dav/property_storage/backend/sequel_mysql_test.rb
|
632
657
|
- test/dav/property_storage/backend/sequel_sqlite_test.rb
|
633
658
|
- test/dav/property_storage/plugin_test.rb
|
634
|
-
- test/dav/server_copy_move_test.rb
|
635
659
|
- test/dav/server_events_test.rb
|
636
660
|
- test/dav/server_mkcol_test.rb
|
637
661
|
- test/dav/server_mock.rb
|
@@ -713,9 +737,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
713
737
|
version: '0'
|
714
738
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
715
739
|
requirements:
|
716
|
-
- - "
|
740
|
+
- - ">="
|
717
741
|
- !ruby/object:Gem::Version
|
718
|
-
version:
|
742
|
+
version: '0'
|
719
743
|
requirements: []
|
720
744
|
rubyforge_project:
|
721
745
|
rubygems_version: 2.2.5
|
data/test/dav/copy_test.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Tilia
|
4
|
-
module Dav
|
5
|
-
class BasicNodeTest < Minitest::Test
|
6
|
-
def setup
|
7
|
-
@temp_dir = Dir.mktmpdir
|
8
|
-
end
|
9
|
-
|
10
|
-
def teardown
|
11
|
-
FileUtils.remove_entry @temp_dir
|
12
|
-
end
|
13
|
-
|
14
|
-
# This test makes sure that a path like /foo cannot be copied into a path
|
15
|
-
# like /foo/bar/
|
16
|
-
def test_copy_into_sub_path
|
17
|
-
dir = Fs::Directory.new(@temp_dir)
|
18
|
-
server = ServerMock.new(dir)
|
19
|
-
|
20
|
-
dir.create_directory('foo')
|
21
|
-
|
22
|
-
request = Http::Request.new(
|
23
|
-
'COPY',
|
24
|
-
'/foo',
|
25
|
-
'Destination' => '/foo/bar'
|
26
|
-
)
|
27
|
-
response = Http::ResponseMock.new
|
28
|
-
|
29
|
-
assert_raises(Exception::Conflict) { server.invoke_method(request, response) }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,164 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Tilia
|
4
|
-
module Dav
|
5
|
-
class ServerCopyMoveTest < AbstractServer
|
6
|
-
def setup
|
7
|
-
super
|
8
|
-
|
9
|
-
@server.debug_exceptions = true
|
10
|
-
|
11
|
-
::File.open("#{@temp_dir}/test2.txt", 'w') { |f| f.write 'Test contents2' }
|
12
|
-
Dir.mkdir("#{@temp_dir}/col")
|
13
|
-
::File.open("#{@temp_dir}/col/test.txt", 'w') { |f| f.write 'Test contents' }
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_copy_over_write
|
17
|
-
server_vars = {
|
18
|
-
'PATH_INFO' => '/test.txt',
|
19
|
-
'REQUEST_METHOD' => 'COPY',
|
20
|
-
'HTTP_DESTINATION' => '/test2.txt'
|
21
|
-
}
|
22
|
-
|
23
|
-
request = Http::Sapi.create_from_server_array(server_vars)
|
24
|
-
@server.http_request = request
|
25
|
-
@server.exec
|
26
|
-
|
27
|
-
assert_equal(204, @response.status, "Received an incorrect HTTP status. Full body inspection: #{@response.body_as_string}")
|
28
|
-
assert_equal(
|
29
|
-
{
|
30
|
-
'X-Sabre-Version' => [Version::VERSION],
|
31
|
-
'Content-Length' => ['0']
|
32
|
-
},
|
33
|
-
@response.headers
|
34
|
-
)
|
35
|
-
|
36
|
-
assert_equal('Test contents', ::File.read("#{@temp_dir}/test2.txt"))
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_copy_to_self
|
40
|
-
server_vars = {
|
41
|
-
'PATH_INFO' => '/test.txt',
|
42
|
-
'REQUEST_METHOD' => 'COPY',
|
43
|
-
'HTTP_DESTINATION' => '/test.txt'
|
44
|
-
}
|
45
|
-
|
46
|
-
request = Http::Sapi.create_from_server_array(server_vars)
|
47
|
-
@server.http_request = request
|
48
|
-
@server.exec
|
49
|
-
|
50
|
-
assert_equal(403, @response.status, "Received an incorrect HTTP status. Full body inspection: #{@response.body_as_string}")
|
51
|
-
assert_equal('Test contents', ::File.read("#{@temp_dir}/test.txt"))
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_non_existant_parent
|
55
|
-
server_vars = {
|
56
|
-
'PATH_INFO' => '/test.txt',
|
57
|
-
'REQUEST_METHOD' => 'COPY',
|
58
|
-
'HTTP_DESTINATION' => '/testcol2/test2.txt',
|
59
|
-
'HTTP_OVERWRITE' => 'F'
|
60
|
-
}
|
61
|
-
|
62
|
-
request = Http::Sapi.create_from_server_array(server_vars)
|
63
|
-
@server.http_request = request
|
64
|
-
@server.exec
|
65
|
-
|
66
|
-
assert_equal(
|
67
|
-
{
|
68
|
-
'X-Sabre-Version' => [Version::VERSION],
|
69
|
-
'Content-Type' => ['application/xml; charset=utf-8']
|
70
|
-
},
|
71
|
-
@response.headers
|
72
|
-
)
|
73
|
-
|
74
|
-
assert_equal(409, @response.status)
|
75
|
-
end
|
76
|
-
|
77
|
-
def test_random_overwrite_header
|
78
|
-
server_vars = {
|
79
|
-
'PATH_INFO' => '/test.txt',
|
80
|
-
'REQUEST_METHOD' => 'COPY',
|
81
|
-
'HTTP_DESTINATION' => '/testcol2/test2.txt',
|
82
|
-
'HTTP_OVERWRITE' => 'SURE!'
|
83
|
-
}
|
84
|
-
|
85
|
-
request = Http::Sapi.create_from_server_array(server_vars)
|
86
|
-
@server.http_request = request
|
87
|
-
@server.exec
|
88
|
-
|
89
|
-
assert_equal(400, @response.status)
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_copy_directory
|
93
|
-
server_vars = {
|
94
|
-
'PATH_INFO' => '/col',
|
95
|
-
'REQUEST_METHOD' => 'COPY',
|
96
|
-
'HTTP_DESTINATION' => '/col2'
|
97
|
-
}
|
98
|
-
|
99
|
-
request = Http::Sapi.create_from_server_array(server_vars)
|
100
|
-
@server.http_request = request
|
101
|
-
@server.exec
|
102
|
-
|
103
|
-
assert_equal(201, @response.status, "Full response: #{@response.body_as_string}")
|
104
|
-
|
105
|
-
assert_equal(
|
106
|
-
{
|
107
|
-
'X-Sabre-Version' => [Version::VERSION],
|
108
|
-
'Content-Length' => ['0']
|
109
|
-
},
|
110
|
-
@response.headers
|
111
|
-
)
|
112
|
-
|
113
|
-
assert_equal('Test contents', ::File.read("#{@temp_dir}/col/test.txt"))
|
114
|
-
end
|
115
|
-
|
116
|
-
def test_simple_copy_file
|
117
|
-
server_vars = {
|
118
|
-
'PATH_INFO' => '/test.txt',
|
119
|
-
'REQUEST_METHOD' => 'COPY',
|
120
|
-
'HTTP_DESTINATION' => '/test3.txt'
|
121
|
-
}
|
122
|
-
|
123
|
-
request = Http::Sapi.create_from_server_array(server_vars)
|
124
|
-
@server.http_request = request
|
125
|
-
@server.exec
|
126
|
-
|
127
|
-
assert_equal(
|
128
|
-
{
|
129
|
-
'X-Sabre-Version' => [Version::VERSION],
|
130
|
-
'Content-Length' => ['0']
|
131
|
-
},
|
132
|
-
@response.headers
|
133
|
-
)
|
134
|
-
|
135
|
-
assert_equal(201, @response.status)
|
136
|
-
assert_equal('Test contents', ::File.read("#{@temp_dir}/test3.txt"))
|
137
|
-
end
|
138
|
-
|
139
|
-
def test_simple_copy_collection
|
140
|
-
server_vars = {
|
141
|
-
'PATH_INFO' => '/col',
|
142
|
-
'REQUEST_METHOD' => 'COPY',
|
143
|
-
'HTTP_DESTINATION' => '/col2'
|
144
|
-
}
|
145
|
-
|
146
|
-
request = Http::Sapi.create_from_server_array(server_vars)
|
147
|
-
@server.http_request = request
|
148
|
-
@server.exec
|
149
|
-
|
150
|
-
assert_equal(201, @response.status, "Incorrect status received. Full response body: #{@response.body_as_string}")
|
151
|
-
|
152
|
-
assert_equal(
|
153
|
-
{
|
154
|
-
'X-Sabre-Version' => [Version::VERSION],
|
155
|
-
'Content-Length' => ['0']
|
156
|
-
},
|
157
|
-
@response.headers
|
158
|
-
)
|
159
|
-
|
160
|
-
assert_equal('Test contents', ::File.read("#{@temp_dir}/col2/test.txt"))
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|