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
@@ -0,0 +1,69 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This server combines both CardDAV and CalDAV functionality into a single
|
3
|
+
# server. It is assumed that the server runs at the root of a HTTP domain (be
|
4
|
+
# that a domainname-based vhost or a specific TCP port.
|
5
|
+
#
|
6
|
+
# This example also assumes that you're using MySQL and the database has
|
7
|
+
# already been setup (along with the database tables).
|
8
|
+
|
9
|
+
# Expected to be called "bundle exec examples/addressbookserver.rb"
|
10
|
+
$LOAD_PATH.unshift './lib'
|
11
|
+
|
12
|
+
require 'tilia/dav'
|
13
|
+
require 'rack'
|
14
|
+
require 'yaml'
|
15
|
+
require 'sequel'
|
16
|
+
|
17
|
+
# UTC or GMT is easy to work with, and usually recommended for any
|
18
|
+
# application.
|
19
|
+
Time.zone = 'UTC'
|
20
|
+
|
21
|
+
# Database
|
22
|
+
database_file = File.join(File.dirname(__FILE__), 'database.yml')
|
23
|
+
fail 'could not load database file for mysql database' unless File.exist?(database_file)
|
24
|
+
config = YAML.load(File.read(database_file))
|
25
|
+
database = config.delete(:database)
|
26
|
+
sequel = Sequel.mysql2(database, config)
|
27
|
+
|
28
|
+
app = proc do |env|
|
29
|
+
# The backends. Yes we do really need all of them.
|
30
|
+
#
|
31
|
+
# This allows any developer to subclass just any of them and hook into their
|
32
|
+
# own backend systems.
|
33
|
+
auth_backend = Tilia::Dav::Auth::Backend::Sequel.new(sequel)
|
34
|
+
principal_backend = Tilia::DavAcl::PrincipalBackend::Sequel.new(sequel)
|
35
|
+
carddav_backend = Tilia::CardDav::Backend::Sequel.new(sequel)
|
36
|
+
caldav_backend = Tilia::CalDav::Backend::Sequel.new(sequel)
|
37
|
+
|
38
|
+
# The directory tree
|
39
|
+
#
|
40
|
+
# Basically this is an array which contains the 'top-level' directories in the
|
41
|
+
# WebDAV server.
|
42
|
+
nodes = [
|
43
|
+
# /principals
|
44
|
+
Tilia::CalDav::Principal::Collection.new(principal_backend),
|
45
|
+
# /calendars
|
46
|
+
Tilia::CalDav::CalendarRoot.new(principal_backend, caldav_backend),
|
47
|
+
# /addressbook
|
48
|
+
Tilia::CardDav::AddressBookRoot.new(principal_backend, carddav_backend)
|
49
|
+
]
|
50
|
+
|
51
|
+
# The object tree needs in turn to be passed to the server class
|
52
|
+
server = Tilia::Dav::Server.new(env, nodes)
|
53
|
+
server.debug_exceptions = true
|
54
|
+
|
55
|
+
# Plugins
|
56
|
+
server.add_plugin(Tilia::Dav::Auth::Plugin.new(auth_backend))
|
57
|
+
server.add_plugin(Tilia::Dav::Browser::Plugin.new)
|
58
|
+
server.add_plugin(Tilia::CardDav::Plugin.new)
|
59
|
+
server.add_plugin(Tilia::CalDav::Plugin.new)
|
60
|
+
server.add_plugin(Tilia::CalDav::Subscriptions::Plugin.new)
|
61
|
+
server.add_plugin(Tilia::CalDav::Schedule::Plugin.new)
|
62
|
+
server.add_plugin(Tilia::DavAcl::Plugin.new)
|
63
|
+
server.add_plugin(Tilia::Dav::Sync::Plugin.new)
|
64
|
+
|
65
|
+
# And off we go!
|
66
|
+
server.exec
|
67
|
+
end
|
68
|
+
|
69
|
+
Rack::Handler::WEBrick.run app
|
@@ -0,0 +1,28 @@
|
|
1
|
+
CREATE TABLE addressbooks (
|
2
|
+
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
3
|
+
principaluri VARBINARY(255),
|
4
|
+
displayname VARCHAR(255),
|
5
|
+
uri VARBINARY(200),
|
6
|
+
description TEXT,
|
7
|
+
synctoken INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
8
|
+
UNIQUE(principaluri(100), uri(100))
|
9
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
10
|
+
|
11
|
+
CREATE TABLE cards (
|
12
|
+
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
13
|
+
addressbookid INT(11) UNSIGNED NOT NULL,
|
14
|
+
carddata MEDIUMBLOB,
|
15
|
+
uri VARBINARY(200),
|
16
|
+
lastmodified INT(11) UNSIGNED,
|
17
|
+
etag VARBINARY(32),
|
18
|
+
size INT(11) UNSIGNED NOT NULL
|
19
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
20
|
+
|
21
|
+
CREATE TABLE addressbookchanges (
|
22
|
+
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
23
|
+
uri VARBINARY(200) NOT NULL,
|
24
|
+
synctoken INT(11) UNSIGNED NOT NULL,
|
25
|
+
addressbookid INT(11) UNSIGNED NOT NULL,
|
26
|
+
operation TINYINT(1) NOT NULL,
|
27
|
+
INDEX addressbookid_synctoken (addressbookid, synctoken)
|
28
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
@@ -0,0 +1,64 @@
|
|
1
|
+
CREATE TABLE calendarobjects (
|
2
|
+
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
3
|
+
calendardata MEDIUMBLOB,
|
4
|
+
uri VARBINARY(200),
|
5
|
+
calendarid INTEGER UNSIGNED NOT NULL,
|
6
|
+
lastmodified INT(11) UNSIGNED,
|
7
|
+
etag VARBINARY(32),
|
8
|
+
size INT(11) UNSIGNED NOT NULL,
|
9
|
+
componenttype VARBINARY(8),
|
10
|
+
firstoccurence INT(11) UNSIGNED,
|
11
|
+
lastoccurence INT(11) UNSIGNED,
|
12
|
+
uid VARBINARY(200),
|
13
|
+
UNIQUE(calendarid, uri)
|
14
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
15
|
+
|
16
|
+
CREATE TABLE calendars (
|
17
|
+
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
18
|
+
principaluri VARBINARY(100),
|
19
|
+
displayname VARCHAR(100),
|
20
|
+
uri VARBINARY(200),
|
21
|
+
synctoken INTEGER UNSIGNED NOT NULL DEFAULT '1',
|
22
|
+
description TEXT,
|
23
|
+
calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
24
|
+
calendarcolor VARBINARY(10),
|
25
|
+
timezone TEXT,
|
26
|
+
components VARBINARY(20),
|
27
|
+
transparent TINYINT(1) NOT NULL DEFAULT '0',
|
28
|
+
UNIQUE(principaluri, uri)
|
29
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
30
|
+
|
31
|
+
CREATE TABLE calendarchanges (
|
32
|
+
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
33
|
+
uri VARBINARY(200) NOT NULL,
|
34
|
+
synctoken INT(11) UNSIGNED NOT NULL,
|
35
|
+
calendarid INT(11) UNSIGNED NOT NULL,
|
36
|
+
operation TINYINT(1) NOT NULL,
|
37
|
+
INDEX calendarid_synctoken (calendarid, synctoken)
|
38
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
39
|
+
|
40
|
+
CREATE TABLE calendarsubscriptions (
|
41
|
+
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
42
|
+
uri VARBINARY(200) NOT NULL,
|
43
|
+
principaluri VARBINARY(100) NOT NULL,
|
44
|
+
source TEXT,
|
45
|
+
displayname VARCHAR(100),
|
46
|
+
refreshrate VARCHAR(10),
|
47
|
+
calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
48
|
+
calendarcolor VARBINARY(10),
|
49
|
+
striptodos TINYINT(1) NULL,
|
50
|
+
stripalarms TINYINT(1) NULL,
|
51
|
+
stripattachments TINYINT(1) NULL,
|
52
|
+
lastmodified INT(11) UNSIGNED,
|
53
|
+
UNIQUE(principaluri, uri)
|
54
|
+
);
|
55
|
+
|
56
|
+
CREATE TABLE schedulingobjects (
|
57
|
+
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
58
|
+
principaluri VARBINARY(255),
|
59
|
+
calendardata MEDIUMBLOB,
|
60
|
+
uri VARBINARY(200),
|
61
|
+
lastmodified INT(11) UNSIGNED,
|
62
|
+
etag VARBINARY(32),
|
63
|
+
size INT(11) UNSIGNED NOT NULL
|
64
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
CREATE TABLE locks (
|
2
|
+
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
3
|
+
owner VARCHAR(100),
|
4
|
+
timeout INTEGER UNSIGNED,
|
5
|
+
created INTEGER,
|
6
|
+
token VARBINARY(100),
|
7
|
+
scope TINYINT,
|
8
|
+
depth TINYINT,
|
9
|
+
uri VARBINARY(1000),
|
10
|
+
INDEX(token),
|
11
|
+
INDEX(uri(100))
|
12
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
13
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
CREATE TABLE principals (
|
2
|
+
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
3
|
+
uri VARBINARY(200) NOT NULL,
|
4
|
+
email VARBINARY(80),
|
5
|
+
displayname VARCHAR(80),
|
6
|
+
UNIQUE(uri)
|
7
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
8
|
+
|
9
|
+
CREATE TABLE groupmembers (
|
10
|
+
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
11
|
+
principal_id INTEGER UNSIGNED NOT NULL,
|
12
|
+
member_id INTEGER UNSIGNED NOT NULL,
|
13
|
+
UNIQUE(principal_id, member_id)
|
14
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
15
|
+
|
16
|
+
|
17
|
+
INSERT INTO principals (uri,email,displayname) VALUES
|
18
|
+
('principals/admin', 'admin@example.org','Administrator'),
|
19
|
+
('principals/admin/calendar-proxy-read', null, null),
|
20
|
+
('principals/admin/calendar-proxy-write', null, null);
|
21
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
CREATE TABLE propertystorage (
|
2
|
+
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
3
|
+
path VARBINARY(1024) NOT NULL,
|
4
|
+
name VARBINARY(100) NOT NULL,
|
5
|
+
valuetype INT UNSIGNED,
|
6
|
+
value MEDIUMBLOB
|
7
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
8
|
+
CREATE UNIQUE INDEX path_property ON propertystorage (path(600), name(100));
|
@@ -0,0 +1,52 @@
|
|
1
|
+
CREATE TABLE addressbooks (
|
2
|
+
id SERIAL NOT NULL,
|
3
|
+
principaluri VARCHAR(255),
|
4
|
+
displayname VARCHAR(255),
|
5
|
+
uri VARCHAR(200),
|
6
|
+
description TEXT,
|
7
|
+
synctoken INTEGER NOT NULL DEFAULT 1
|
8
|
+
);
|
9
|
+
|
10
|
+
ALTER TABLE ONLY addressbooks
|
11
|
+
ADD CONSTRAINT addressbooks_pkey PRIMARY KEY (id);
|
12
|
+
|
13
|
+
CREATE UNIQUE INDEX addressbooks_ukey
|
14
|
+
ON addressbooks USING btree (principaluri, uri);
|
15
|
+
|
16
|
+
CREATE TABLE cards (
|
17
|
+
id SERIAL NOT NULL,
|
18
|
+
addressbookid INTEGER NOT NULL,
|
19
|
+
carddata TEXT,
|
20
|
+
uri VARCHAR(200),
|
21
|
+
lastmodified INTEGER,
|
22
|
+
etag VARCHAR(32),
|
23
|
+
size INTEGER NOT NULL
|
24
|
+
);
|
25
|
+
|
26
|
+
ALTER TABLE ONLY cards
|
27
|
+
ADD CONSTRAINT cards_pkey PRIMARY KEY (id);
|
28
|
+
|
29
|
+
CREATE UNIQUE INDEX cards_ukey
|
30
|
+
ON cards USING btree (addressbookid, uri);
|
31
|
+
|
32
|
+
ALTER TABLE ONLY cards
|
33
|
+
ADD CONSTRAINT cards_addressbookid_fkey FOREIGN KEY (addressbookid) REFERENCES addressbooks(id)
|
34
|
+
ON DELETE CASCADE;
|
35
|
+
|
36
|
+
CREATE TABLE addressbookchanges (
|
37
|
+
id SERIAL NOT NULL,
|
38
|
+
uri VARCHAR(200) NOT NULL,
|
39
|
+
synctoken INTEGER NOT NULL,
|
40
|
+
addressbookid INTEGER NOT NULL,
|
41
|
+
operation SMALLINT NOT NULL
|
42
|
+
);
|
43
|
+
|
44
|
+
ALTER TABLE ONLY addressbookchanges
|
45
|
+
ADD CONSTRAINT addressbookchanges_pkey PRIMARY KEY (id);
|
46
|
+
|
47
|
+
CREATE INDEX addressbookchanges_addressbookid_synctoken_ix
|
48
|
+
ON addressbookchanges USING btree (addressbookid, synctoken);
|
49
|
+
|
50
|
+
ALTER TABLE ONLY addressbookchanges
|
51
|
+
ADD CONSTRAINT addressbookchanges_addressbookid_fkey FOREIGN KEY (addressbookid) REFERENCES addressbooks(id)
|
52
|
+
ON DELETE CASCADE;
|
@@ -0,0 +1,93 @@
|
|
1
|
+
CREATE TABLE calendars (
|
2
|
+
id SERIAL NOT NULL,
|
3
|
+
principaluri VARCHAR(100),
|
4
|
+
displayname VARCHAR(100),
|
5
|
+
uri VARCHAR(200),
|
6
|
+
synctoken INTEGER NOT NULL DEFAULT 1,
|
7
|
+
description TEXT,
|
8
|
+
calendarorder INTEGER NOT NULL DEFAULT 0,
|
9
|
+
calendarcolor VARCHAR(10),
|
10
|
+
timezone TEXT,
|
11
|
+
components VARCHAR(20),
|
12
|
+
uid VARCHAR(200),
|
13
|
+
transparent SMALLINT NOT NULL DEFAULT '0'
|
14
|
+
);
|
15
|
+
|
16
|
+
ALTER TABLE ONLY calendars
|
17
|
+
ADD CONSTRAINT calendars_pkey PRIMARY KEY (id);
|
18
|
+
|
19
|
+
CREATE UNIQUE INDEX calendars_ukey
|
20
|
+
ON calendars USING btree (principaluri, uri);
|
21
|
+
|
22
|
+
CREATE TABLE calendarobjects (
|
23
|
+
id SERIAL NOT NULL,
|
24
|
+
calendardata TEXT,
|
25
|
+
uri VARCHAR(200),
|
26
|
+
calendarid INTEGER NOT NULL,
|
27
|
+
lastmodified INTEGER,
|
28
|
+
etag VARCHAR(32),
|
29
|
+
size INTEGER NOT NULL,
|
30
|
+
componenttype VARCHAR(8),
|
31
|
+
firstoccurence INTEGER,
|
32
|
+
lastoccurence INTEGER,
|
33
|
+
uid VARCHAR(200)
|
34
|
+
);
|
35
|
+
|
36
|
+
ALTER TABLE ONLY calendarobjects
|
37
|
+
ADD CONSTRAINT calendarobjects_pkey PRIMARY KEY (id);
|
38
|
+
|
39
|
+
CREATE UNIQUE INDEX calendarobjects_ukey
|
40
|
+
ON calendarobjects USING btree (calendarid, uri);
|
41
|
+
|
42
|
+
ALTER TABLE ONLY calendarobjects
|
43
|
+
ADD CONSTRAINT calendarobjects_calendarid_fkey FOREIGN KEY (calendarid) REFERENCES calendars(id)
|
44
|
+
ON DELETE CASCADE;
|
45
|
+
|
46
|
+
CREATE TABLE calendarsubscriptions (
|
47
|
+
id SERIAL NOT NULL,
|
48
|
+
uri VARCHAR(200) NOT NULL,
|
49
|
+
principaluri VARCHAR(100) NOT NULL,
|
50
|
+
source TEXT,
|
51
|
+
displayname VARCHAR(100),
|
52
|
+
refreshrate VARCHAR(10),
|
53
|
+
calendarorder INTEGER NOT NULL DEFAULT 0,
|
54
|
+
calendarcolor VARCHAR(10),
|
55
|
+
striptodos SMALLINT NULL,
|
56
|
+
stripalarms SMALLINT NULL,
|
57
|
+
stripattachments SMALLINT NULL,
|
58
|
+
lastmodified INTEGER
|
59
|
+
);
|
60
|
+
|
61
|
+
ALTER TABLE ONLY calendarsubscriptions
|
62
|
+
ADD CONSTRAINT calendarsubscriptions_pkey PRIMARY KEY (id);
|
63
|
+
|
64
|
+
CREATE UNIQUE INDEX calendarsubscriptions_ukey
|
65
|
+
ON calendarsubscriptions USING btree (principaluri, uri);
|
66
|
+
|
67
|
+
CREATE TABLE calendarchanges (
|
68
|
+
id SERIAL NOT NULL,
|
69
|
+
uri VARCHAR(200) NOT NULL,
|
70
|
+
synctoken INTEGER NOT NULL,
|
71
|
+
calendarid INTEGER NOT NULL,
|
72
|
+
operation SMALLINT NOT NULL DEFAULT 0
|
73
|
+
);
|
74
|
+
|
75
|
+
ALTER TABLE ONLY calendarchanges
|
76
|
+
ADD CONSTRAINT calendarchanges_pkey PRIMARY KEY (id);
|
77
|
+
|
78
|
+
CREATE INDEX calendarchanges_calendarid_synctoken_ix
|
79
|
+
ON calendarchanges USING btree (calendarid, synctoken);
|
80
|
+
|
81
|
+
ALTER TABLE ONLY calendarchanges
|
82
|
+
ADD CONSTRAINT calendarchanges_calendar_fk FOREIGN KEY (calendarid) REFERENCES calendars(id)
|
83
|
+
ON DELETE CASCADE;
|
84
|
+
|
85
|
+
CREATE TABLE schedulingobjects (
|
86
|
+
id SERIAL NOT NULL,
|
87
|
+
principaluri VARCHAR(255),
|
88
|
+
calendardata BYTEA,
|
89
|
+
uri VARCHAR(200),
|
90
|
+
lastmodified INTEGER,
|
91
|
+
etag VARCHAR(32),
|
92
|
+
size INTEGER NOT NULL
|
93
|
+
);
|
@@ -0,0 +1,19 @@
|
|
1
|
+
CREATE TABLE locks (
|
2
|
+
id SERIAL NOT NULL,
|
3
|
+
owner VARCHAR(100),
|
4
|
+
timeout INTEGER,
|
5
|
+
created INTEGER,
|
6
|
+
token VARCHAR(100),
|
7
|
+
scope SMALLINT,
|
8
|
+
depth SMALLINT,
|
9
|
+
uri TEXT
|
10
|
+
);
|
11
|
+
|
12
|
+
ALTER TABLE ONLY locks
|
13
|
+
ADD CONSTRAINT locks_pkey PRIMARY KEY (id);
|
14
|
+
|
15
|
+
CREATE INDEX locks_token_ix
|
16
|
+
ON locks USING btree (token);
|
17
|
+
|
18
|
+
CREATE INDEX locks_uri_ix
|
19
|
+
ON locks USING btree (uri);
|
@@ -0,0 +1,38 @@
|
|
1
|
+
CREATE TABLE principals (
|
2
|
+
id SERIAL NOT NULL,
|
3
|
+
uri VARCHAR(200) NOT NULL,
|
4
|
+
email VARCHAR(80),
|
5
|
+
displayname VARCHAR(80)
|
6
|
+
);
|
7
|
+
|
8
|
+
ALTER TABLE ONLY principals
|
9
|
+
ADD CONSTRAINT principals_pkey PRIMARY KEY (id);
|
10
|
+
|
11
|
+
CREATE UNIQUE INDEX principals_ukey
|
12
|
+
ON principals USING btree (uri);
|
13
|
+
|
14
|
+
CREATE TABLE groupmembers (
|
15
|
+
id SERIAL NOT NULL,
|
16
|
+
principal_id INTEGER NOT NULL,
|
17
|
+
member_id INTEGER NOT NULL
|
18
|
+
);
|
19
|
+
|
20
|
+
ALTER TABLE ONLY groupmembers
|
21
|
+
ADD CONSTRAINT groupmembers_pkey PRIMARY KEY (id);
|
22
|
+
|
23
|
+
CREATE UNIQUE INDEX groupmembers_ukey
|
24
|
+
ON groupmembers USING btree (principal_id, member_id);
|
25
|
+
|
26
|
+
ALTER TABLE ONLY groupmembers
|
27
|
+
ADD CONSTRAINT groupmembers_principal_id_fkey FOREIGN KEY (principal_id) REFERENCES principals(id)
|
28
|
+
ON DELETE CASCADE;
|
29
|
+
|
30
|
+
ALTER TABLE ONLY groupmembers
|
31
|
+
ADD CONSTRAINT groupmembers_member_id_id_fkey FOREIGN KEY (member_id) REFERENCES principals(id)
|
32
|
+
ON DELETE CASCADE;
|
33
|
+
|
34
|
+
INSERT INTO principals (uri,email,displayname) VALUES
|
35
|
+
('principals/admin', 'admin@example.org','Administrator'),
|
36
|
+
('principals/admin/calendar-proxy-read', null, null),
|
37
|
+
('principals/admin/calendar-proxy-write', null, null);
|
38
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
CREATE TABLE propertystorage (
|
2
|
+
id SERIAL NOT NULL,
|
3
|
+
path VARCHAR(1024) NOT NULL,
|
4
|
+
name VARCHAR(100) NOT NULL,
|
5
|
+
valuetype INT,
|
6
|
+
value TEXT
|
7
|
+
);
|
8
|
+
|
9
|
+
ALTER TABLE ONLY propertystorage
|
10
|
+
ADD CONSTRAINT propertystorage_pkey PRIMARY KEY (id);
|
11
|
+
|
12
|
+
CREATE UNIQUE INDEX propertystorage_ukey
|
13
|
+
ON propertystorage (path, name);
|
@@ -0,0 +1,14 @@
|
|
1
|
+
CREATE TABLE users (
|
2
|
+
id SERIAL NOT NULL,
|
3
|
+
username VARCHAR(50),
|
4
|
+
digesta1 VARCHAR(32)
|
5
|
+
);
|
6
|
+
|
7
|
+
ALTER TABLE ONLY users
|
8
|
+
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
|
9
|
+
|
10
|
+
CREATE UNIQUE INDEX users_ukey
|
11
|
+
ON users USING btree (username);
|
12
|
+
|
13
|
+
INSERT INTO users (username,digesta1) VALUES
|
14
|
+
('admin', '2bd199b750010a686f5908c2551d39b3');
|