From 46966225ad429a5030359fa79a43c7bce6c3baa5 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 24 Jan 2008 09:07:16 +1300 Subject: [PATCH 01/65] Show the duration of the regression test run. --- testing/run_regressions.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/testing/run_regressions.sh b/testing/run_regressions.sh index 71183764..791484b6 100755 --- a/testing/run_regressions.sh +++ b/testing/run_regressions.sh @@ -70,6 +70,10 @@ TEST="Load-Sample-Data" psql -q -f "../dba/sample-data.sql" "${DBNAME}" >"${RESULTS}/${TEST}" 2>&1 check_result "${TEST}" +# psql -q -f "../dba/patches/1.1.12.sql" "${DBNAME}" + +TSTART="`date +%s`" + for T in ${REGRESSION}/*.test ; do TEST="`basename ${T} .test`" TESTNUM="`echo ${TEST} | cut -f1 -d'-'`" @@ -82,3 +86,6 @@ for T in ${REGRESSION}/*.test ; do check_result "${TEST}" done +TFINISH="`date +%s`" + +echo "Regression test run took $(( ${TFINISH} - ${TSTART} )) seconds." From 867dd9a181b2e080bb2555d01822272fe5fd5cc1 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 00:17:07 +1300 Subject: [PATCH 02/65] Display the number of tests also at the end of the regression run. --- testing/run_regressions.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testing/run_regressions.sh b/testing/run_regressions.sh index 791484b6..25c382bd 100755 --- a/testing/run_regressions.sh +++ b/testing/run_regressions.sh @@ -73,6 +73,7 @@ check_result "${TEST}" # psql -q -f "../dba/patches/1.1.12.sql" "${DBNAME}" TSTART="`date +%s`" +TCOUNT=0 for T in ${REGRESSION}/*.test ; do TEST="`basename ${T} .test`" @@ -85,7 +86,8 @@ for T in ${REGRESSION}/*.test ; do check_result "${TEST}" + TCOUNT=$(( ${TCOUNT} + 1 )) done TFINISH="`date +%s`" -echo "Regression test run took $(( ${TFINISH} - ${TSTART} )) seconds." +echo "Regression test run took $(( ${TFINISH} - ${TSTART} )) seconds for ${TCOUNT} tests." From eef603b509eabf60a22d8bf5aab79a37b5a09e43 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 24 Jan 2008 23:26:42 +1300 Subject: [PATCH 03/65] Move the appuser permission grants out of the database definition so we can support alternative names for the application DB user. --- dba/appuser_permissions.txt | 48 +++++++++++++++++++ dba/davical.sql | 92 ++++++++++++++++++++++++------------- dba/update-rscds-database | 67 +++++++++++++++++++++++++-- 3 files changed, 172 insertions(+), 35 deletions(-) create mode 100644 dba/appuser_permissions.txt diff --git a/dba/appuser_permissions.txt b/dba/appuser_permissions.txt new file mode 100644 index 00000000..5c8d5b4d --- /dev/null +++ b/dba/appuser_permissions.txt @@ -0,0 +1,48 @@ +# +# This file is used by update-rscds-database to set the correct +# permissions for the application user. In newer installations +# the application user will probably be called app_davical (and +# the administrative user will be called dba_davical) but in +# older installations the application user was called 'general' +# and the administrative user was probably 'postgres'. +# +# See the wiki topic 'Database/Users' for more discussion. +# +# This file includes lines like: +# GRANT SELECT,... +# which define what gets granted to the following lines like: +# ON table1, table2, sequence1, function 3, view4, ... +# no user-serviceable parts inside, all whitespace is ignored, +# your mileage should not vary :-) +# + +GRANT SELECT,INSERT,UPDATE,DELETE + ON collection + ON caldav_data + ON calendar_item + ON relationship + ON locks + ON property + ON freebusy_ticket + ON usr + ON usr_setting + ON roles + ON role_member + ON session + ON tmp_password + +GRANT SELECT,UPDATE + ON caldav_data_dav_id_seq + ON relationship_type_rt_id_seq + ON dav_id_seq + ON usr_user_no_seq + ON roles_role_no_seq + ON session_session_id_seq + +GRANT SELECT,INSERT + ON time_zone + +GRANT SELECT + ON supported_locales + ON awl_db_revision + ON relationship_type diff --git a/dba/davical.sql b/dba/davical.sql index b8dc8a0a..27ba688a 100644 --- a/dba/davical.sql +++ b/dba/davical.sql @@ -1,6 +1,23 @@ -- Really Simple CalDAV Store - Database Schema -- +-- Something that can look like a filesystem hierarchy where we store stuff +CREATE TABLE collection ( + user_no INT references usr(user_no) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, + parent_container TEXT, + dav_name TEXT, + dav_etag TEXT, + dav_displayname TEXT, + is_calendar BOOLEAN, + created TIMESTAMP WITH TIME ZONE, + modified TIMESTAMP WITH TIME ZONE, + public_events_only BOOLEAN NOT NULL DEFAULT FALSE, + publicly_readable BOOLEAN NOT NULL DEFAULT FALSE, + + PRIMARY KEY ( user_no, dav_name ) +); + + -- The main event. Where we store the things the calendar throws at us. CREATE TABLE caldav_data ( user_no INT references usr(user_no) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, @@ -11,11 +28,11 @@ CREATE TABLE caldav_data ( caldav_data TEXT, caldav_type TEXT, logged_user INT references usr(user_no), + dav_id SERIAL UNIQUE, PRIMARY KEY ( user_no, dav_name ) ); -GRANT SELECT,INSERT,UPDATE,DELETE ON caldav_data TO general; -- Not particularly needed, perhaps, except as a way to collect -- a bunch of valid iCalendar time zone specifications... :-) @@ -24,7 +41,7 @@ CREATE TABLE time_zone ( tz_locn TEXT, tz_spec TEXT ); -GRANT SELECT,INSERT ON time_zone TO general; + -- The parsed calendar item. Here we have pulled those events/todos/journals apart somewhat. CREATE TABLE calendar_item ( @@ -51,6 +68,7 @@ CREATE TABLE calendar_item ( percent_complete NUMERIC(7,2), tz_id TEXT REFERENCES time_zone( tz_id ), status TEXT, + dav_id INT8 UNIQUE, -- Cascade updates / deletes from the caldav_data table CONSTRAINT caldav_exists FOREIGN KEY ( user_no, dav_name ) @@ -60,25 +78,6 @@ CREATE TABLE calendar_item ( PRIMARY KEY ( user_no, dav_name ) ); -GRANT SELECT,INSERT,UPDATE,DELETE ON calendar_item TO general; - - --- Something that can look like a filesystem hierarchy where we store stuff -CREATE TABLE collection ( - user_no INT references usr(user_no) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, - parent_container TEXT, - dav_name TEXT, - dav_etag TEXT, - dav_displayname TEXT, - is_calendar BOOLEAN, - created TIMESTAMP WITH TIME ZONE, - modified TIMESTAMP WITH TIME ZONE, - public_events_only BOOLEAN NOT NULL DEFAULT FALSE, - - PRIMARY KEY ( user_no, dav_name ) -); - -GRANT SELECT,INSERT,UPDATE,DELETE ON collection TO general; -- Each user can be related to each other user. This mechanism can also -- be used to define groups of users, since some relationships are transitive. @@ -90,8 +89,6 @@ CREATE TABLE relationship_type ( rt_fromgroup BOOLEAN ); -GRANT SELECT,INSERT,UPDATE,DELETE ON relationship_type TO general; -GRANT SELECT,UPDATE ON relationship_type_rt_id_seq TO general; CREATE TABLE relationship ( from_user INT REFERENCES usr (user_no) ON UPDATE CASCADE, @@ -101,8 +98,6 @@ CREATE TABLE relationship ( PRIMARY KEY ( from_user, to_user, rt_id ) ); -GRANT SELECT,INSERT,UPDATE,DELETE ON relationship TO general; - CREATE TABLE locks ( dav_name TEXT, @@ -114,9 +109,8 @@ CREATE TABLE locks ( timeout INTERVAL, start TIMESTAMP DEFAULT current_timestamp ); - CREATE INDEX locks_dav_name_idx ON locks(dav_name); -GRANT SELECT,INSERT,UPDATE,DELETE ON locks TO general; + CREATE TABLE property ( dav_name TEXT, @@ -126,9 +120,8 @@ CREATE TABLE property ( changed_by INT REFERENCES usr ( user_no ), PRIMARY KEY ( dav_name, property_name ) ); - CREATE INDEX properties_dav_name_idx ON property(dav_name); -GRANT SELECT,INSERT,UPDATE,DELETE ON property TO general; + CREATE TABLE freebusy_ticket ( ticket_id TEXT NOT NULL PRIMARY KEY, @@ -136,6 +129,43 @@ CREATE TABLE freebusy_ticket ( created timestamp with time zone DEFAULT current_timestamp NOT NULL ); -GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE freebusy_ticket TO general; -SELECT new_db_revision(1,1,11, 'November' ); +CREATE or REPLACE FUNCTION sync_dav_id ( ) RETURNS TRIGGER AS ' + DECLARE + BEGIN + + IF TG_OP = ''DELETE'' THEN + -- Just let the ON DELETE CASCADE handle this case + RETURN OLD; + END IF; + + IF NEW.dav_id IS NULL THEN + NEW.dav_id = nextval(''caldav_data_dav_id_seq''); + END IF; + + IF TG_OP = ''UPDATE'' THEN + IF OLD.dav_id = NEW.dav_id THEN + -- Nothing to do + RETURN NEW; + END IF; + END IF; + + IF TG_RELNAME = ''caldav_data'' THEN + UPDATE calendar_item SET dav_id = NEW.dav_id WHERE user_no = NEW.user_no AND dav_name = NEW.dav_name; + ELSE + UPDATE caldav_data SET dav_id = NEW.dav_id WHERE user_no = NEW.user_no AND dav_name = NEW.dav_name; + END IF; + + RETURN NEW; + + END +' LANGUAGE 'plpgsql'; + +CREATE TRIGGER caldav_data_sync_dav_id AFTER INSERT OR UPDATE ON caldav_data + FOR EACH ROW EXECUTE PROCEDURE sync_dav_id(); + +CREATE TRIGGER calendar_item_sync_dav_id AFTER INSERT OR UPDATE ON calendar_item + FOR EACH ROW EXECUTE PROCEDURE sync_dav_id(); + + +SELECT new_db_revision(1,1,12, 'December' ); diff --git a/dba/update-rscds-database b/dba/update-rscds-database index d00cf691..14ee22a1 100755 --- a/dba/update-rscds-database +++ b/dba/update-rscds-database @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # -# Update the RSCDS database by repeatedly applying patches to it +# Update the DAViCal database by repeatedly applying patches to it # in the correct order. # @@ -12,11 +12,12 @@ use Getopt::Long qw(:config permute); # allow mixed args. # Options variables my $debug = 0; -my $dbname = "rscds"; +my $dbname = "davical"; my $dbport = 5432; my $dbuser = ""; my $dbpass = ""; my $dbhost = ""; +my $appuser = "general"; my $helpmeplease = 0; my $dbadir = $0; @@ -30,6 +31,7 @@ GetOptions ('debug!' => \$debug, 'dbpass=s' => \$dbpass, 'dbport=s' => \$dbport, 'dbhost=s' => \$dbhost, + 'appuser=s' => \$appuser, 'help' => \$helpmeplease ); show_usage() if ( $helpmeplease ); @@ -94,6 +96,10 @@ print "Supported locales updated.\n"; apply_sql_file( $dbadir, "caldav_functions.sql" ); print "CalDAV functions updated.\n"; +# Ensure the permissions are up to date +apply_permissions( $dbadir, "appuser_permissions.txt" ); +print "Database permissions updated.\n"; + # The End! exit 0; @@ -198,6 +204,10 @@ sub apply_patch { ############################################################ # Apply SQL File +# Note that this stuffs the password into an environment +# variable, which isn't ideal. If you use a .pgpass you +# can bypass that issue, but you still need it on the command +# line for this program until I get a patch from someone. ############################################################ sub apply_sql_file { @@ -218,6 +228,48 @@ sub apply_sql_file { } + +############################################################ +# Apply database permissions from file +############################################################ +sub apply_permissions { + + my $sqldir = shift; + my $permsfile = shift; + + open PERMS, '<', $sqldir."/".$permsfile; + my $dbh = DBI->connect($dsn, $dbuser, $dbpass, { AutoCommit => 1 } ) or die "Can't connect to database $dbname"; + + my $sql; + my $current_grant; + + while( ) { + next if ( /^\s*(#|--)/ ); + + /^\s*GRANT\s+(\S.*)\s*$/i && do { + $current_grant = $1; + }; + + /^\s*ON\s+(\S.*)\s*$/i && do { + defined($current_grant) or die "No GRANT before ON in $permsfile\n"; + my $doohickeys = $1; + + $sql = sprintf( "REVOKE ALL ON %s FROM %s, general", $doohickeys, $appuser ); + print $sql, "\n" if ( $debug ); + $dbh->do($sql); + + $sql = sprintf( "GRANT %s on %s to %s", $current_grant, $doohickeys, $appuser ); + print $sql, "\n" if ( $debug ); + $dbh->do($sql); + }; + + } + close(PERMS); + $dbh->disconnect; +} + + + ############################################################ # Tell the nice user how we do things. Short and sweet. ############################################################ @@ -232,9 +284,16 @@ Options are: --dbuser Connect to the database as this user. --dbport Connect to the database on this port. --dbhost Connect to the database on this host. + --appuser The username which the application uses for it's database + connection. -The program will apply patches to the database which have -not yet been applied. +The program will apply any patches to the database which have +not yet been applied, run any desired data patch scripts and set +the correct minimum permissions for the web application user. + +Rather than providing a password on the command-line it is recommended +that you use a .pgpass file in your home directory to hold the database +password. This file must be mode 600 to work. OPTHELP exit 0; From 7120632632d2ef950bc2e1a2c84a73c9b304d1bd Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 25 Jan 2008 08:00:47 +1300 Subject: [PATCH 04/65] Add options to not apply any patches. --- dba/update-rscds-database | 90 ++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/dba/update-rscds-database b/dba/update-rscds-database index 14ee22a1..9883415a 100755 --- a/dba/update-rscds-database +++ b/dba/update-rscds-database @@ -19,6 +19,9 @@ my $dbpass = ""; my $dbhost = ""; my $appuser = "general"; my $helpmeplease = 0; +my $apply_patches = 1; +my $revoke_list = "general"; +my $config_file = ""; my $dbadir = $0; $dbadir =~ s#/[^/]*$##; @@ -32,6 +35,9 @@ GetOptions ('debug!' => \$debug, 'dbport=s' => \$dbport, 'dbhost=s' => \$dbhost, 'appuser=s' => \$appuser, + 'patch!' => \$apply_patches, + 'revoke=s' => \$revoke_list, + 'config=s' => \$config_file, 'help' => \$helpmeplease ); show_usage() if ( $helpmeplease ); @@ -44,50 +50,54 @@ my $dsn = "dbi:Pg:dbname=$dbname"; $dsn .= ";host=$dbhost" if ( "$dbhost" ne "" ); $dsn .= ";port=$dbport" if ( $dbport != 5432 ); -my $current_revision = get_current_revision(); -printf( "The database is currently at revision %d.%d.%d.\n", $current_revision->{'schema_major'}, $current_revision->{'schema_minor'}, $current_revision->{'schema_patch'} ); - -opendir( PATCHDIR, $patchdir ) or die "Can't open patch directory $patchdir"; -my @patches = grep { /^([0-9]+)\.([0-9]+)\.([0-9]+)([a-z]?)\.sql$/ } readdir(PATCHDIR); -closedir(PATCHDIR); - -@patches = sort { compare_revisions(revision_hash($a),revision_hash($b), 1); } @patches; - -my $applied = 0; +my $current_revision; my $last_results = ''; # Will hold the last SQL result from applying a patch -for ( my $i=0; $i <= $#patches; $i++ ) { - printf( "Looking at patches[%d] (%s)\n", $i, $patches[$i]) if ( $debug ); - if ( compare_revisions(revision_hash($patches[$i]),$current_revision) > 0 ) { - print "Applying patch $patches[$i] ... "; - if ( !apply_patch( $patches[$i] ) ) { - # Skip to the end unless the next patch is an alternate for the same version. - if ( defined($patches[$i+1]) && compare_revisions(revision_hash($patches[$i]),revision_hash($patches[$i+1])) == 0 ) { - print "failed. Attempting next alternative.\n"; - $applied--; +if ( $apply_patches ) { + $current_revision = get_current_revision(); + printf( "The database is currently at revision %d.%d.%d.\n", $current_revision->{'schema_major'}, $current_revision->{'schema_minor'}, $current_revision->{'schema_patch'} ); + + opendir( PATCHDIR, $patchdir ) or die "Can't open patch directory $patchdir"; + my @patches = grep { /^([0-9]+)\.([0-9]+)\.([0-9]+)([a-z]?)\.sql$/ } readdir(PATCHDIR); + closedir(PATCHDIR); + + @patches = sort { compare_revisions(revision_hash($a),revision_hash($b), 1); } @patches; + + my $applied = 0; + + for ( my $i=0; $i <= $#patches; $i++ ) { + printf( "Looking at patches[%d] (%s)\n", $i, $patches[$i]) if ( $debug ); + if ( compare_revisions(revision_hash($patches[$i]),$current_revision) > 0 ) { + print "Applying patch $patches[$i] ... "; + if ( !apply_patch( $patches[$i] ) ) { + # Skip to the end unless the next patch is an alternate for the same version. + if ( defined($patches[$i+1]) && compare_revisions(revision_hash($patches[$i]),revision_hash($patches[$i+1])) == 0 ) { + print "failed. Attempting next alternative.\n"; + $applied--; + } + else { + print "failed!\n$last_results ==> No further patches will be attempted!\n"; + last; + } } else { - print "failed!\n$last_results ==> No further patches will be attempted!\n"; - last; + print "succeeded.\n"; } + $applied++; } else { - print "succeeded.\n"; + print "Patch $patches[$i] has already been applied.\n" if ( $debug ); } - $applied++; + } + + if ( $applied ) { + print "Successfully applied $applied patches.\n"; } else { - print "Patch $patches[$i] has already been applied.\n" if ( $debug ); + print "No patches were applied.\n"; } } -if ( $applied ) { - print "Successfully applied $applied patches.\n"; -} -else { - print "No patches were applied.\n"; -} - # Ensure the locales data is up to date apply_sql_file( $dbadir, "supported_locales.sql" ); print "Supported locales updated.\n"; @@ -254,7 +264,7 @@ sub apply_permissions { defined($current_grant) or die "No GRANT before ON in $permsfile\n"; my $doohickeys = $1; - $sql = sprintf( "REVOKE ALL ON %s FROM %s, general", $doohickeys, $appuser ); + $sql = sprintf( "REVOKE ALL ON %s FROM %s, %s", $doohickeys, $appuser, $revoke_list ); print $sql, "\n" if ( $debug ); $dbh->do($sql); @@ -279,13 +289,15 @@ sub show_usage { update-rscds-database [options] Options are: - --debug Turn on debugging - --dbname The database to dig into - --dbuser Connect to the database as this user. - --dbport Connect to the database on this port. - --dbhost Connect to the database on this host. - --appuser The username which the application uses for it's database - connection. + --debug Turn on debugging + --dbname name The database to dig into + --dbuser name Connect to the database as this user. + --dbport 5432 Connect to the database on this port. + --dbhost name Connect to the database on this host. + --appuser name The username which the application uses for it's database + connection. + --nopatch Don't try and apply any patches + --revoke name Revoke permissions from this user The program will apply any patches to the database which have not yet been applied, run any desired data patch scripts and set From 7226068a04ffeef935fe58edf6f40936f2e4458c Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 25 Jan 2008 08:01:15 +1300 Subject: [PATCH 05/65] Ensure database creation applies the right permissions. --- dba/create-database.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dba/create-database.sh b/dba/create-database.sh index a944cac6..24be25c9 100755 --- a/dba/create-database.sh +++ b/dba/create-database.sh @@ -68,8 +68,18 @@ psql -q -f "${AWLDIR}/dba/schema-management.sql" "${DBNAME}" 2>&1 | egrep -v "(^ # Load the DAViCal tables psql -q -f "${DBADIR}/davical.sql" "${DBNAME}" 2>&1 | egrep -v "(^CREATE |^GRANT|^BEGIN|^COMMIT| NOTICE: )" -psql -q -f "${DBADIR}/caldav_functions.sql" "${DBNAME}" +# psql -q -f "${DBADIR}/caldav_functions.sql" "${DBNAME}" +# +# The supported locales are in a separate file to make them easier to upgrade +#psql -q -f "${DBADIR}/supported_locales.sql" "${DBNAME}" + +# +# Set permissions for the application DB user on the database +${DBADIR}/update-rscds-database --dbname "${DBNAME}" --appuser "${AWL_APPUSER}" --nopatch --revoke "general" + +# +# Load the required base data psql -q -f "${DBADIR}/base-data.sql" "${DBNAME}" # @@ -96,7 +106,3 @@ fi psql -q -c "UPDATE usr SET password = '**${ADMINPW}' WHERE user_no = 1;" "${DBNAME}" echo "The password for the 'admin' user has been set to '${ADMINPW}'" - -# -# The supported locales are in a separate file to make them easier to upgrade -psql -q -f "${DBADIR}/supported_locales.sql" "${DBNAME}" From c93b004c0a6ef46d9658ab67b2c075d801b98fe3 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 25 Jan 2008 08:01:53 +1300 Subject: [PATCH 06/65] Regression test result changes now we call update-rscds-database --- testing/tests/regression-suite/Create-Database.result | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testing/tests/regression-suite/Create-Database.result b/testing/tests/regression-suite/Create-Database.result index 1c342838..fe8f849c 100644 --- a/testing/tests/regression-suite/Create-Database.result +++ b/testing/tests/regression-suite/Create-Database.result @@ -9,6 +9,11 @@ CREATE DATABASE t (1 row) +Supported locales updated. +DBD::Pg::db do failed: ERROR: relation "dav_id_seq" does not exist +DBD::Pg::db do failed: ERROR: relation "dav_id_seq" does not exist +CalDAV functions updated. +Database permissions updated. setval -------- 10 From d63b3092181bcfdaf9339659c2e86dc93ef8a4ac Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 00:23:16 +1300 Subject: [PATCH 07/65] Add configuration file to database updating. --- config/example-administration.yml | 38 +++++++++++++++++++++++++++++++ dba/update-rscds-database | 36 +++++++++++++++++++++++++---- 2 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 config/example-administration.yml diff --git a/config/example-administration.yml b/config/example-administration.yml new file mode 100644 index 00000000..c6948932 --- /dev/null +++ b/config/example-administration.yml @@ -0,0 +1,38 @@ +# +# Administration Configuration file (sample) +# +# This file is only used by command-line programs accessing the DAViCal +# database for maintenance. It should be as secure as you can make it +# since it contains passwords and connection details for a more powerful +# database connection. Mode 600 is recommended. +# +# This file should be called 'administration.cfg' in the config directory. +# + +## +## The database username for connecting with sufficient rights to create +## tables, functions and granting access to other users. +admin_db_user: davical_dba + +## +## The password. Leading and trailling spaces are stripped, so don't do that +#admin_db_pass: very, very 5ecret + +## +## The hostname/IP. Not needed if using unix sockets to a local server. +#admin_db_host: 2401:170:20:17::1024:0 +#admin_db_host: 172.17.217.2 +#admin_db_host: dbserver.davical.net + +## +## The database name +admin_db_name: davical + +## +## The database port. Not needed if it is the default '5432' +#admin_db_port: 5432 + + +## +## The name of the database user the web application uses to connect +app_db_user: davical_app diff --git a/dba/update-rscds-database b/dba/update-rscds-database index 9883415a..c038cd3a 100755 --- a/dba/update-rscds-database +++ b/dba/update-rscds-database @@ -10,9 +10,11 @@ use DBI; use POSIX qw(floor); use Getopt::Long qw(:config permute); # allow mixed args. +use YAML qw( LoadFile ); + # Options variables my $debug = 0; -my $dbname = "davical"; +my $dbname = "rscds"; my $dbport = 5432; my $dbuser = ""; my $dbpass = ""; @@ -20,13 +22,33 @@ my $dbhost = ""; my $appuser = "general"; my $helpmeplease = 0; my $apply_patches = 1; -my $revoke_list = "general"; -my $config_file = ""; +my $revoke_list = ""; +my $config_file = "config/administration.yml"; my $dbadir = $0; $dbadir =~ s#/[^/]*$##; my $patchdir = $dbadir . "/patches"; +# +# We look in a few places for the config file. First relative to +# where we are, then relative to the code we are running, then we +# start to look in absolute locations. Then we give up :-) +if ( ! -f $config_file ) { + $config_file = $0; + $config_file =~ s{[^/]+/update-[a-z]+-database}{config/administration.yml}; +} +if ( ! -f $config_file ) { + $config_file = "/etc/davical/administration.yml"; +} +if ( -f $config_file ) { + my ($ycfg) = LoadFile($config_file); + $dbuser = $ycfg->{'admin_db_user'} if ( defined($ycfg->{'admin_db_user'})); + $dbpass = $ycfg->{'admin_db_pass'} if ( defined($ycfg->{'admin_db_pass'})); + $dbhost = $ycfg->{'admin_db_host'} if ( defined($ycfg->{'admin_db_host'})); + $dbname = $ycfg->{'admin_db_name'} if ( defined($ycfg->{'admin_db_name'})); + $dbport = $ycfg->{'admin_db_port'} if ( defined($ycfg->{'admin_db_port'})); + $appuser = $ycfg->{'app_db_user'} if ( defined($ycfg->{'app_db_user'})); +} GetOptions ('debug!' => \$debug, 'dbname=s' => \$dbname, @@ -37,11 +59,13 @@ GetOptions ('debug!' => \$debug, 'appuser=s' => \$appuser, 'patch!' => \$apply_patches, 'revoke=s' => \$revoke_list, - 'config=s' => \$config_file, 'help' => \$helpmeplease ); show_usage() if ( $helpmeplease ); +$revoke_list = ", ". $revoke_list if ( $revoke_list ne "" ); + + ############################################################ # Open database connection. Note that the standard PostgreSQL # environment variables will also work with DBD::Pg. @@ -50,6 +74,8 @@ my $dsn = "dbi:Pg:dbname=$dbname"; $dsn .= ";host=$dbhost" if ( "$dbhost" ne "" ); $dsn .= ";port=$dbport" if ( $dbport != 5432 ); +print "Using database: $dbuser".'%'.$dbpass.'@'.$dsn."\n" if ( $debug ); + my $current_revision; my $last_results = ''; # Will hold the last SQL result from applying a patch @@ -264,7 +290,7 @@ sub apply_permissions { defined($current_grant) or die "No GRANT before ON in $permsfile\n"; my $doohickeys = $1; - $sql = sprintf( "REVOKE ALL ON %s FROM %s, %s", $doohickeys, $appuser, $revoke_list ); + $sql = sprintf( "REVOKE ALL ON %s FROM %s %s", $doohickeys, $appuser, $revoke_list ); print $sql, "\n" if ( $debug ); $dbh->do($sql); From 0679ceb866c311694b81ec85c9c6e5fb1ef2c6b5 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 25 Jan 2008 08:06:52 +1300 Subject: [PATCH 08/65] Remove commented code. --- dba/create-database.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dba/create-database.sh b/dba/create-database.sh index 24be25c9..cd6b4d8a 100755 --- a/dba/create-database.sh +++ b/dba/create-database.sh @@ -68,12 +68,6 @@ psql -q -f "${AWLDIR}/dba/schema-management.sql" "${DBNAME}" 2>&1 | egrep -v "(^ # Load the DAViCal tables psql -q -f "${DBADIR}/davical.sql" "${DBNAME}" 2>&1 | egrep -v "(^CREATE |^GRANT|^BEGIN|^COMMIT| NOTICE: )" -# psql -q -f "${DBADIR}/caldav_functions.sql" "${DBNAME}" - -# -# The supported locales are in a separate file to make them easier to upgrade -#psql -q -f "${DBADIR}/supported_locales.sql" "${DBNAME}" - # # Set permissions for the application DB user on the database ${DBADIR}/update-rscds-database --dbname "${DBNAME}" --appuser "${AWL_APPUSER}" --nopatch --revoke "general" From c61d3edac650750d59d43f7c8fcbca55c7c51ef6 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 00:28:00 +1300 Subject: [PATCH 09/65] New tables need new permissions. And we now use the specific appuser / dbuser for everything. --- dba/appuser_permissions.txt | 10 ++++++++++ dba/create-database.sh | 10 +++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dba/appuser_permissions.txt b/dba/appuser_permissions.txt index 5c8d5b4d..09f212e4 100644 --- a/dba/appuser_permissions.txt +++ b/dba/appuser_permissions.txt @@ -30,6 +30,10 @@ GRANT SELECT,INSERT,UPDATE,DELETE ON role_member ON session ON tmp_password + ON dav_resource + ON group_member + ON principal + ON privilege GRANT SELECT,UPDATE ON caldav_data_dav_id_seq @@ -38,6 +42,9 @@ GRANT SELECT,UPDATE ON usr_user_no_seq ON roles_role_no_seq ON session_session_id_seq + ON dav_resource_type_resource_type_id_seq + ON principal_principal_id_seq + ON principal_type_principal_type_id_seq GRANT SELECT,INSERT ON time_zone @@ -46,3 +53,6 @@ GRANT SELECT ON supported_locales ON awl_db_revision ON relationship_type + ON dav_resource_type + ON principal_type + diff --git a/dba/create-database.sh b/dba/create-database.sh index cd6b4d8a..f19c85d4 100755 --- a/dba/create-database.sh +++ b/dba/create-database.sh @@ -43,7 +43,7 @@ create_db_user() { } create_plpgsql_language() { - if ! psql -qAt template1 -c "SELECT lanname FROM pg_language;" | grep "^plpgsql$" >/dev/null; then + if ! psql -U ${AWL_DBAUSER} -qAt template1 -c "SELECT lanname FROM pg_language;" | grep "^plpgsql$" >/dev/null; then createlang plpgsql "${DBNAME}" fi } @@ -61,12 +61,12 @@ create_plpgsql_language # # Load the AWL base tables and schema management tables -psql -q -f "${AWLDIR}/dba/awl-tables.sql" "${DBNAME}" 2>&1 | egrep -v "(^CREATE |^GRANT|^BEGIN|^COMMIT| NOTICE: )" -psql -q -f "${AWLDIR}/dba/schema-management.sql" "${DBNAME}" 2>&1 | egrep -v "(^CREATE |^GRANT|^BEGIN|^COMMIT| NOTICE: )" +psql -q -U "${AWL_DBAUSER}" -f "${AWLDIR}/dba/awl-tables.sql" "${DBNAME}" 2>&1 | egrep -v "(^CREATE |^GRANT|^BEGIN|^COMMIT| NOTICE: )" +psql -q -U "${AWL_DBAUSER}" -f "${AWLDIR}/dba/schema-management.sql" "${DBNAME}" 2>&1 | egrep -v "(^CREATE |^GRANT|^BEGIN|^COMMIT| NOTICE: )" # # Load the DAViCal tables -psql -q -f "${DBADIR}/davical.sql" "${DBNAME}" 2>&1 | egrep -v "(^CREATE |^GRANT|^BEGIN|^COMMIT| NOTICE: )" +psql -q -U "${AWL_DBAUSER}" -f "${DBADIR}/davical.sql" "${DBNAME}" 2>&1 | egrep -v "(^CREATE |^GRANT|^BEGIN|^COMMIT| NOTICE: )" # # Set permissions for the application DB user on the database @@ -74,7 +74,7 @@ ${DBADIR}/update-rscds-database --dbname "${DBNAME}" --appuser "${AWL_APPUSER}" # # Load the required base data -psql -q -f "${DBADIR}/base-data.sql" "${DBNAME}" +psql -q -U "${AWL_DBAUSER}" -f "${DBADIR}/base-data.sql" "${DBNAME}" # # We can override the admin password generation for regression testing predictability From 113fb6a40fa17333d232ec9d6cba621da9c20699 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 19 Jan 2008 12:26:39 +1300 Subject: [PATCH 10/65] Add a function to assist with renaming users. --- dba/caldav_functions.sql | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/dba/caldav_functions.sql b/dba/caldav_functions.sql index cdbddde6..877d360b 100644 --- a/dba/caldav_functions.sql +++ b/dba/caldav_functions.sql @@ -339,3 +339,28 @@ BEGIN RETURN rlist; END; ' LANGUAGE 'plpgsql'; + + +CREATE or REPLACE FUNCTION rename_davical_user( TEXT, TEXT ) RETURNS TEXT AS $$ +DECLARE + oldname ALIAS FOR $1; + newname ALIAS FOR $2; + oldpath TEXT; + newpath TEXT; +BEGIN + UPDATE usr SET username = newname WHERE username = oldname; + oldpath := '/' || oldname | '/'; + newpath := '/' || newname | '/'; + + UPDATE collection + SET parent_container = replace( parent_container, oldpath, newpath), + dav_name = replace( dav_name, oldpath, newpath) + WHERE substring(dav_name from 1 for char_length(oldpath)) = oldpath; + + UPDATE caldav_data + SET dav_name = replace( dav_name, oldpath, newpath) + WHERE substring(dav_name from 1 for char_length(oldpath)) = oldpath; + + RETURN newname; +END; +$$ LANGUAGE plpgsql; From 36f57b149ead3fce91efd9de9edf4823ac78945b Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 21 Jan 2008 16:01:32 +1300 Subject: [PATCH 11/65] Fix to work with FastCGI installation. --- inc/HTTPAuthSession.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/inc/HTTPAuthSession.php b/inc/HTTPAuthSession.php index b066148f..c9c66b22 100644 --- a/inc/HTTPAuthSession.php +++ b/inc/HTTPAuthSession.php @@ -83,6 +83,22 @@ class HTTPAuthSession { */ function BasicAuthSession() { global $c; + + /** + * Get HTTP Auth to work with PHP+FastCGI + */ + if (isset($_SERVER["AUTHORIZATION"]) && !empty($_SERVER["AUTHORIZATION"])) { + list ($type, $cred) = split (" ", $_SERVER['AUTHORIZATION']); + if ($type == 'Basic') { + list ($user, $pass) = explode (":", base64_decode($cred)); + $_SERVER['PHP_AUTH_USER'] = $user; + $_SERVER['PHP_AUTH_PW'] = $pass; + } + } + + /** + * Fall through to the normal PHP authentication variables. + */ if ( isset($_SERVER['PHP_AUTH_USER']) ) { if ( $u = $this->CheckPassword( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] ) ) { $this->AssignSessionDetails($u); From 73af27361050be21190519f33010d08d866c2064 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 21 Jan 2008 16:12:16 +1300 Subject: [PATCH 12/65] Move the dumping of the server variables to before HTTP Auth in case it is helpful (it very likely will be) for debugging authentication issues. --- htdocs/caldav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/caldav.php b/htdocs/caldav.php index 5a82cd0a..a8a1a73b 100644 --- a/htdocs/caldav.php +++ b/htdocs/caldav.php @@ -10,9 +10,9 @@ */ require_once("../inc/always.php"); dbg_error_log( "caldav", " User agent: %s", ((isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "Unfortunately Mulberry does not send a 'User-agent' header with its requests :-(")) ); +dbg_log_array( "headers", '_SERVER', $_SERVER, true ); require_once("HTTPAuthSession.php"); $session = new HTTPAuthSession(); -dbg_log_array( "headers", '_SERVER', $_SERVER, true ); /** * From reading the "Scheduling Extensions to CalDAV" draft I don't think that we will From c6b312e04a9d62d01231e621f03c800e7fa128b2 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 21 Jan 2008 17:30:31 +1300 Subject: [PATCH 13/65] Fix debugging code so this doesn't break a server with open_basedir enabled. Not that I in any way endorse the use of open_basedir... --- inc/always.php | 6 +++--- inc/caldav-PUT-functions.php | 8 +++++--- inc/caldav-REPORT.php | 8 +++++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/inc/always.php b/inc/always.php index 54192d7d..db477f2a 100644 --- a/inc/always.php +++ b/inc/always.php @@ -53,13 +53,13 @@ $c->protocol_server_port_script = sprintf( "%s://%s%s%s", (isset($_SERVER['HTTPS init_gettext( 'rscds', '../locale' ); -if ( file_exists("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php") ) { +if ( @file_exists("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php") ) { include_once("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php"); } -else if ( file_exists("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php") ) { +else if ( @file_exists("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php") ) { include_once("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php"); } -else if ( file_exists("../config/config.php") ) { +else if ( @file_exists("../config/config.php") ) { include_once("../config/config.php"); } else { diff --git a/inc/caldav-PUT-functions.php b/inc/caldav-PUT-functions.php index e58af608..28e856fe 100644 --- a/inc/caldav-PUT-functions.php +++ b/inc/caldav-PUT-functions.php @@ -124,10 +124,12 @@ function import_collection( $ics_content, $user_no, $path, $caldav_context ) { // According to RFC2445 we should always end with CRLF, but the CalDAV spec says // that normalising XML parses often muck with it and may remove the CR. $icalendar = preg_replace('/\r?\n /', '', $ics_content ); - if ( isset($c->dbg['ALL']) || isset($c->dbg['put']) ) { + if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || isset($c->dbg['put'])) ) { $fh = fopen('/tmp/PUT-2.txt','w'); - fwrite($fh,$icalendar); - fclose($fh); + if ( $fh ) { + fwrite($fh,$icalendar); + fclose($fh); + } } $lines = preg_split('/\r?\n/', $icalendar ); diff --git a/inc/caldav-REPORT.php b/inc/caldav-REPORT.php index e3c4c34a..727cbad8 100644 --- a/inc/caldav-REPORT.php +++ b/inc/caldav-REPORT.php @@ -10,10 +10,12 @@ */ dbg_error_log("REPORT", "method handler"); -if ( isset($c->dbg['ALL']) || $c->dbg['report'] ) { +if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || $c->dbg['report']) ) { $fh = fopen('/tmp/REPORT.txt','w'); - fwrite($fh,$request->raw_post); - fclose($fh); + if ( $fh ) { + fwrite($fh,$request->raw_post); + fclose($fh); + } } if ( ! ($request->AllowedTo('read') || $request->AllowedTo('freebusy')) ) { From a4d8ba9440caca7f5e88bf2673bda518d977a79f Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 21 Jan 2008 17:31:26 +1300 Subject: [PATCH 14/65] Fix typo. --- dba/caldav_functions.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dba/caldav_functions.sql b/dba/caldav_functions.sql index 877d360b..fc66dfce 100644 --- a/dba/caldav_functions.sql +++ b/dba/caldav_functions.sql @@ -349,8 +349,8 @@ DECLARE newpath TEXT; BEGIN UPDATE usr SET username = newname WHERE username = oldname; - oldpath := '/' || oldname | '/'; - newpath := '/' || newname | '/'; + oldpath := '/' || oldname || '/'; + newpath := '/' || newname || '/'; UPDATE collection SET parent_container = replace( parent_container, oldpath, newpath), From 8afea491a9cb55bcea43e74a519d1305da1a815a Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Tue, 22 Jan 2008 22:14:01 +1300 Subject: [PATCH 15/65] Fix for when open_basedir is in force. --- inc/caldav-PUT.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/inc/caldav-PUT.php b/inc/caldav-PUT.php index cf8b9d57..13933273 100644 --- a/inc/caldav-PUT.php +++ b/inc/caldav-PUT.php @@ -14,10 +14,12 @@ if ( ! $request->AllowedTo("read") ) { $request->DoResponse(403); } -if ( isset($c->dbg['ALL']) || $c->dbg['put'] ) { +if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || $c->dbg['put']) ) { $fh = fopen('/tmp/PUT.txt','w'); - fwrite($fh,$request->raw_post); - fclose($fh); + if ( $fh ) { + fwrite($fh,$request->raw_post); + fclose($fh); + } } include_once('caldav-PUT-functions.php'); From 86fc2b657c4047aa8fd08c69725d9bcede1b77d5 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Tue, 22 Jan 2008 22:14:29 +1300 Subject: [PATCH 16/65] Point to new Wiki URL. --- docs/website/inc/page-header.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/website/inc/page-header.php b/docs/website/inc/page-header.php index 2b8d7558..659845fd 100644 --- a/docs/website/inc/page-header.php +++ b/docs/website/inc/page-header.php @@ -29,7 +29,7 @@ else { Installation | Client Config | Administration | -DAViCal Wiki | +DAViCal Wiki | Blog | DAViCal on Sourceforge From 167c498c553982a73d4eb662612864db64a6c3d3 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 23 Jan 2008 10:48:33 +1300 Subject: [PATCH 17/65] Improve performance of get_permissions when groups are involved. --- dba/caldav_functions.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dba/caldav_functions.sql b/dba/caldav_functions.sql index fc66dfce..e1f0d812 100644 --- a/dba/caldav_functions.sql +++ b/dba/caldav_functions.sql @@ -249,7 +249,10 @@ BEGIN SELECT rt1.confers, rt2.confers INTO out_confers, tmp_confers FROM relationship r1 JOIN relationship_type rt1 USING(rt_id) JOIN relationship r2 ON r1.to_user=r2.from_user JOIN relationship_type rt2 ON r2.rt_id=rt2.rt_id - WHERE r1.from_user=in_from AND r2.to_user=in_to AND usr_is_role(r1.to_user,''Group'') AND NOT usr_is_role(r2.to_user,''Group'') AND NOT usr_is_role(r1.from_user,''Group''); + WHERE r1.from_user=in_from AND r2.to_user=in_to + AND EXISTS( SELECT 1 FROM role_member JOIN roles USING(role_no) WHERE role_member.user_no=r1.to_user AND roles.role_name=''Group'') + AND NOT EXISTS( SELECT 1 FROM role_member JOIN roles USING(role_no) WHERE role_member.user_no=r2.to_user AND roles.role_name=''Group'') + AND NOT EXISTS( SELECT 1 FROM role_member JOIN roles USING(role_no) WHERE role_member.user_no=r1.from_user AND roles.role_name=''Group''); IF FOUND THEN -- RAISE NOTICE ''Permissions to group % from group %'', out_confers, tmp_confers; From 9e84ab6e142858f179729f1d3fe5c07b443ada89 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 23 Jan 2008 18:03:28 +1300 Subject: [PATCH 18/65] Efficiency improvements from bypassing get_permissions() call in query. --- inc/caldav-GET.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/caldav-GET.php b/inc/caldav-GET.php index 6b1e1b1c..a65fa9b5 100644 --- a/inc/caldav-GET.php +++ b/inc/caldav-GET.php @@ -23,10 +23,10 @@ if ( $request->IsCollection() ) { * The CalDAV specification does not define GET on a collection, but typically this is * used as a .ics download for the whole collection, which is what we do also. */ - $qry = new PgQuery( "SELECT caldav_data, class, caldav_type, calendar_item.user_no, get_permissions($session->user_no,caldav_data.user_no) as permissions FROM caldav_data LEFT JOIN calendar_item USING ( dav_name ) WHERE caldav_data.user_no = ? AND caldav_data.dav_name ~ ? $privacy_clause ORDER BY caldav_data.user_no, caldav_data.dav_name, caldav_data.created;", $request->user_no, $request->path.'[^/]+$'); + $qry = new PgQuery( "SELECT caldav_data, class, caldav_type, calendar_item.user_no FROM caldav_data LEFT JOIN calendar_item USING ( dav_name ) WHERE caldav_data.user_no = ? AND caldav_data.dav_name ~ ? $privacy_clause ORDER BY caldav_data.user_no, caldav_data.dav_name, caldav_data.created;", $request->user_no, $request->path.'[^/]+$'); } else { - $qry = new PgQuery( "SELECT caldav_data, caldav_data.dav_etag, class, caldav_type, calendar_item.user_no, get_permissions($session->user_no,caldav_data.user_no) as permissions FROM caldav_data LEFT JOIN calendar_item USING ( dav_name ) WHERE caldav_data.user_no = ? AND caldav_data.dav_name = ? $privacy_clause;", $request->user_no, $request->path); + $qry = new PgQuery( "SELECT caldav_data, caldav_data.dav_etag, class, caldav_type, calendar_item.user_no FROM caldav_data LEFT JOIN calendar_item USING ( dav_name ) WHERE caldav_data.user_no = ? AND caldav_data.dav_name = ? $privacy_clause;", $request->user_no, $request->path); } dbg_error_log("get", "%s", $qry->querystring ); if ( $qry->Exec("GET") && $qry->rows == 1 ) { @@ -54,7 +54,7 @@ else if ( $qry->rows > 1 ) { $ical = new iCalendar( array( "icalendar" => $event->caldav_data ) ); $timezones[$ical->Get("TZID")] = 1; - if ( !is_numeric(strpos($event->permissions,'A')) && $session->user_no != $event->user_no ){ + if ( !$request->AllowedTo('all') && $session->user_no != $event->user_no ){ // the user is not admin / owner of this calendarlooking at his calendar and can not admin the other cal if ( $event->class == 'CONFIDENTIAL' ) { // if the event is confidential we fake one that just says "Busy" From 98654043c53670c4157b79e4a45fe8ca04952a6e Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 23 Jan 2008 18:20:15 +1300 Subject: [PATCH 19/65] Efficiency improvements from bypassing get_permissions() call in query. --- inc/caldav-PROPFIND.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/inc/caldav-PROPFIND.php b/inc/caldav-PROPFIND.php index 6fa2a19a..65b3a807 100644 --- a/inc/caldav-PROPFIND.php +++ b/inc/caldav-PROPFIND.php @@ -607,13 +607,17 @@ function get_collection_contents( $depth, $user_no, $collection ) { */ if ( $request->AllowedTo('read') ) { dbg_error_log("PROPFIND","Getting collection items: Depth %d, User: %d, Path: %s", $depth, $user_no, $collection->dav_name ); + $privacy_clause = " "; + if ( ! $request->AllowedTo('all') ) { + $privacy_clause = " AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL) "; + } $sql = "SELECT caldav_data.dav_name, caldav_data, caldav_data.dav_etag, "; $sql .= "to_char(coalesce(calendar_item.created, caldav_data.created) at time zone 'GMT',?) AS created, "; $sql .= "to_char(last_modified at time zone 'GMT',?) AS modified, "; $sql .= "summary AS dav_displayname "; - $sql .= "FROM caldav_data JOIN calendar_item USING( user_no, dav_name) WHERE dav_name ~ ".qpg('^'.$collection->dav_name.'[^/]+$'); - $sql .= " AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL OR get_permissions($session->user_no,caldav_data.user_no) ~ 'A') "; // Must have 'all' permissions to see confidential items + $sql .= "FROM caldav_data JOIN calendar_item USING( user_no, dav_name) "; + $sql .= "WHERE dav_name ~ ".qpg('^'.$collection->dav_name.'[^/]+$'). $privacy_clause; $sql .= "ORDER BY caldav_data.dav_name "; $qry = new PgQuery($sql, PgQuery::Plain(iCalendar::HttpDateFormat()), PgQuery::Plain(iCalendar::HttpDateFormat())); if( $qry->Exec("PROPFIND",__LINE__,__FILE__) && $qry->rows > 0 ) { @@ -685,17 +689,21 @@ function get_collection( $depth, $user_no, $collection_path ) { * Get XML response for a single item. Depth is irrelevant for this. */ function get_item( $item_path ) { - global $session; + global $session, $request; $responses = array(); dbg_error_log("PROPFIND","Getting item: Path: %s", $item_path ); + $privacy_clause = " "; + if ( ! $request->AllowedTo('all') ) { + $privacy_clause = " AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL) "; + } + $sql = "SELECT caldav_data.dav_name, caldav_data, caldav_data.dav_etag, "; $sql .= "to_char(coalesce(calendar_item.created, caldav_data.created) at time zone 'GMT',?) AS created, "; $sql .= "to_char(last_modified at time zone 'GMT',?) AS modified, "; $sql .= "summary AS dav_displayname "; - $sql .= "FROM caldav_data JOIN calendar_item USING( user_no, dav_name) WHERE dav_name = ? "; - $sql .= "AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL OR get_permissions($session->user_no,caldav_data.user_no) ~ 'A') "; // Must have 'all' permissions to see confidential items + $sql .= "FROM caldav_data JOIN calendar_item USING( user_no, dav_name) WHERE dav_name = ? $privacy_clause"; $qry = new PgQuery($sql, PgQuery::Plain(iCalendar::HttpDateFormat()), PgQuery::Plain(iCalendar::HttpDateFormat()), $item_path); if( $qry->Exec("PROPFIND",__LINE__,__FILE__) && $qry->rows > 0 ) { while( $item = $qry->Fetch() ) { From e6bbd589733618585c69b9f8110a690cf00fdbd2 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 23 Jan 2008 18:41:11 +1300 Subject: [PATCH 20/65] Efficiency improvements from bypassing get_permissions() call in query. --- inc/caldav-REPORT-calquery.php | 13 ++++++++----- inc/caldav-REPORT-freebusy.php | 5 ++++- inc/caldav-REPORT-multiget.php | 14 ++++++++------ inc/caldav-REPORT.php | 2 +- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/inc/caldav-REPORT-calquery.php b/inc/caldav-REPORT-calquery.php index 837a7f24..af5f7e92 100644 --- a/inc/caldav-REPORT-calquery.php +++ b/inc/caldav-REPORT-calquery.php @@ -235,12 +235,15 @@ if ( is_array($qry_filters) ) { dbg_log_array( "calquery", "qry_filters", $qry_filters, true ); $where .= BuildSqlFilter( $qry_filters ); } - -$where .= "AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL OR get_permissions($session->user_no,caldav_data.user_no) ~ 'A') "; // Must have 'all' permissions to see confidential items -if ( isset($c->hide_TODO) && $c->hide_TODO ) { - $where .= "AND (caldav_data.caldav_type NOT IN ('VTODO') OR get_permissions($session->user_no,caldav_data.user_no) ~ 'A') "; +if ( ! $request->AllowedTo('all') ) { + $where .= "AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL) "; } -$qry = new PgQuery( "SELECT * , get_permissions($session->user_no,caldav_data.user_no) as permissions FROM caldav_data INNER JOIN calendar_item USING(user_no, dav_name)". $where . " ORDER BY caldav_data.user_no, caldav_data.dav_name" ); + +if ( isset($c->hide_TODO) && $c->hide_TODO && ! $request->AllowedTo('all') ) { + $where .= "AND caldav_data.caldav_type NOT IN ('VTODO') "; +} + +$qry = new PgQuery( "SELECT * FROM caldav_data INNER JOIN calendar_item USING(user_no, dav_name)". $where . " ORDER BY caldav_data.user_no, caldav_data.dav_name" ); if ( $qry->Exec("calquery",__LINE__,__FILE__) && $qry->rows > 0 ) { while( $calendar_object = $qry->Fetch() ) { if ( !$need_post_filter || apply_filter( $qry_filters, $calendar_object ) ) { diff --git a/inc/caldav-REPORT-freebusy.php b/inc/caldav-REPORT-freebusy.php index 30037914..9f0145f3 100644 --- a/inc/caldav-REPORT-freebusy.php +++ b/inc/caldav-REPORT-freebusy.php @@ -23,7 +23,10 @@ if ( isset( $fbq_end ) ) { $where .= "AND caldav_data.caldav_type IN ( 'VEVENT', 'VFREEBUSY' ) "; $where .= "AND (calendar_item.transp != 'TRANSPARENT' OR calendar_item.transp IS NULL) "; $where .= "AND (calendar_item.status != 'CANCELLED' OR calendar_item.status IS NULL) "; -$where .= "AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL OR get_permissions($session->user_no,caldav_data.user_no) ~ 'A') "; // Must have 'all' permissions to see confidential items + +if ( ! $request->AllowedTo('all') ) { + $where .= "AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL) "; +} $busy = array(); $busy_tentative = array(); diff --git a/inc/caldav-REPORT-multiget.php b/inc/caldav-REPORT-multiget.php index edd4fffa..f0d0a292 100644 --- a/inc/caldav-REPORT-multiget.php +++ b/inc/caldav-REPORT-multiget.php @@ -47,12 +47,15 @@ $where = " WHERE caldav_data.dav_name ~ ".qpg("^".$request->path)." "; if ( $href_in != "" ) { $where .= " AND caldav_data.dav_name IN ( $href_in ) "; } - -$where .= "AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL OR get_permissions($session->user_no,caldav_data.user_no) ~ 'A') "; // Must have 'all' permissions to see confidential items -if ( isset($c->hide_TODO) && $c->hide_TODO ) { - $where .= "AND (caldav_data.caldav_type NOT IN ('VTODO') OR get_permissions($session->user_no,caldav_data.user_no) ~ 'A') "; +if ( ! $request->AllowedTo('all') ) { + $where .= "AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL) "; } -$qry = new PgQuery( "SELECT * , get_permissions($session->user_no,caldav_data.user_no) as permissions FROM caldav_data INNER JOIN calendar_item USING(user_no, dav_name)". $where ); + +if ( isset($c->hide_TODO) && $c->hide_TODO && ! $request->AllowedTo('all') ) { + $where .= "AND caldav_data.caldav_type NOT IN ('VTODO') "; +} + +$qry = new PgQuery( "SELECT * FROM caldav_data INNER JOIN calendar_item USING(user_no, dav_name)". $where ); if ( $qry->Exec("REPORT",__LINE__,__FILE__) && $qry->rows > 0 ) { while( $calendar_object = $qry->Fetch() ) { $responses[] = calendar_to_xml( $properties, $calendar_object ); @@ -62,4 +65,3 @@ if ( $qry->Exec("REPORT",__LINE__,__FILE__) && $qry->rows > 0 ) { $multistatus = new XMLElement( "multistatus", $responses, array('xmlns'=>'DAV:') ); $request->XMLResponse( 207, $multistatus ); -?> \ No newline at end of file diff --git a/inc/caldav-REPORT.php b/inc/caldav-REPORT.php index 727cbad8..79bedf80 100644 --- a/inc/caldav-REPORT.php +++ b/inc/caldav-REPORT.php @@ -70,7 +70,7 @@ function calendar_to_xml( $properties, $item ) { $caldav_data = $item->caldav_data; $displayname = $item->summary; if ( isset($properties['CALENDAR-DATA']) || isset($properties['DISPLAYNAME']) ) { - if ( !is_numeric(strpos($item->permissions,'A')) && $session->user_no != $item->user_no ){ + if ( !$request->AllowedTo('all') && $session->user_no != $item->user_no ){ // the user is not admin / owner of this calendarlooking at his calendar and can not admin the other cal if ( $item->class == 'CONFIDENTIAL' ) { $ical = new iCalendar( array( "icalendar" => $caldav_data) ); From ac79f648319bccd289a71f4046aab511e26b542b Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 23 Jan 2008 20:06:23 +1300 Subject: [PATCH 21/65] An alternative patch 1.1.12 which will work without exact correspondence between caldav_data & calendar_item --- dba/patches/1.1.12a.sql | 74 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 dba/patches/1.1.12a.sql diff --git a/dba/patches/1.1.12a.sql b/dba/patches/1.1.12a.sql new file mode 100644 index 00000000..525da349 --- /dev/null +++ b/dba/patches/1.1.12a.sql @@ -0,0 +1,74 @@ + +-- Add a numeric foreign key link between caldav_data and calendar_item to +-- provide more efficient linking when the db has been initialised with a +-- non POSIX collation. + +-- This alternative patch file is the same in/out revision as 1.1.12 but it works where +-- for some reason some caldav_data rows do not have related calendar_item rows. + +BEGIN; +SELECT check_db_revision(1,1,11); + +-- Add a column to the collection table to allow us to mark collections +-- as publicly readable +ALTER TABLE collection ADD COLUMN publicly_readable BOOLEAN DEFAULT FALSE; + +-- Add a numeric dav_id to link the caldav_data and calendar_item tables +ALTER TABLE caldav_data ADD COLUMN dav_id INT8; +ALTER TABLE calendar_item ADD COLUMN dav_id INT8; +CREATE SEQUENCE caldav_data_dav_id_seq; +GRANT SELECT,UPDATE ON caldav_data_dav_id_seq TO general; + +CREATE or REPLACE FUNCTION sync_dav_id ( ) RETURNS TRIGGER AS ' + DECLARE + BEGIN + + IF TG_OP = ''DELETE'' THEN + -- Just let the ON DELETE CASCADE handle this case + RETURN OLD; + END IF; + + IF NEW.dav_id IS NULL THEN + NEW.dav_id = nextval(''caldav_data_dav_id_seq''); + END IF; + + IF TG_OP = ''UPDATE'' THEN + IF OLD.dav_id = NEW.dav_id THEN + -- Nothing to do + RETURN NEW; + END IF; + END IF; + + IF TG_RELNAME = ''caldav_data'' THEN + UPDATE calendar_item SET dav_id = NEW.dav_id WHERE user_no = NEW.user_no AND dav_name = NEW.dav_name; + ELSE + UPDATE caldav_data SET dav_id = NEW.dav_id WHERE user_no = NEW.user_no AND dav_name = NEW.dav_name; + END IF; + + RETURN NEW; + + END +' LANGUAGE 'plpgsql'; + +CREATE TRIGGER caldav_data_sync_dav_id AFTER INSERT OR UPDATE ON caldav_data + FOR EACH ROW EXECUTE PROCEDURE sync_dav_id(); + +CREATE TRIGGER calendar_item_sync_dav_id AFTER INSERT OR UPDATE ON calendar_item + FOR EACH ROW EXECUTE PROCEDURE sync_dav_id(); + +-- Now, using the trigger, magically assign dav_id to all rows in caldav_data and calendar_item +UPDATE caldav_data SET dav_id = dav_id; +UPDATE caldav_data set dav_id = nextval('caldav_data_dav_id_seq') WHERE dav_id IS NULL; +UPDATE calendar_item set dav_id = nextval('caldav_data_dav_id_seq') WHERE dav_id IS NULL; + +ALTER TABLE caldav_data ALTER COLUMN dav_id SET DEFAULT nextval('caldav_data_dav_id_seq'); +ALTER TABLE caldav_data ALTER COLUMN dav_id SET NOT NULL; +ALTER TABLE caldav_data ADD CONSTRAINT caldav_data_dav_id_key UNIQUE (dav_id); + +ALTER TABLE calendar_item ADD CONSTRAINT calendar_item_dav_id_key UNIQUE (dav_id); + +SELECT new_db_revision(1,1,12, 'December' ); + +COMMIT; +ROLLBACK; + From 8c786ad934bd3961dfa5df5310b4aae59a72d16d Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 24 Jan 2008 07:49:44 +1300 Subject: [PATCH 22/65] Correct comments to reflect reality. --- inc/RRule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/RRule.php b/inc/RRule.php index b1a50648..78341859 100644 --- a/inc/RRule.php +++ b/inc/RRule.php @@ -701,7 +701,7 @@ class RRule { /**#@-*/ /** - * The constructor takes a start & end date and an RRULE definition. All of these + * The constructor takes a start date and an RRULE definition. Both of these * follow the iCalendar standard. */ function RRule( $start, $rrule ) { From ce649d20d33a5d3c82b0fc88403e17c038a4a5ae Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 24 Jan 2008 07:50:08 +1300 Subject: [PATCH 23/65] Paranoia sprinkles. --- inc/always.php.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inc/always.php.in b/inc/always.php.in index 85e7dbbd..2f32fa5b 100644 --- a/inc/always.php.in +++ b/inc/always.php.in @@ -9,6 +9,9 @@ // Ensure the configuration starts out as an empty object. unset($c); +// Ditto for a few other global things +unset($session); unset($request); unset($dbconn); + // Default some of the configurable values $c->sysabbr = 'davical'; $c->admin_email = 'admin@davical.example.com'; From f54fd0719d1d305f07143f547c81534ea5ae1a2d Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 24 Jan 2008 21:55:35 +1300 Subject: [PATCH 24/65] Move debugging of headers to before http auth, making it more useful. --- htdocs/freebusy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/freebusy.php b/htdocs/freebusy.php index eaa04739..224c820e 100644 --- a/htdocs/freebusy.php +++ b/htdocs/freebusy.php @@ -1,9 +1,9 @@ Date: Thu, 24 Jan 2008 21:57:26 +1300 Subject: [PATCH 25/65] Improve performance, with resulting ordering change. --- inc/caldav-REPORT-calquery.php | 14 +- .../regression-suite/105-Evo-REPORT-1.result | 20 +- .../regression-suite/107-Evo-REPORT-1.result | 20 +- .../regression-suite/108-Evo-REPORT-1.result | 20 +- .../regression-suite/203-Moz-REPORT-2.result | 86 ++-- .../231-Moz-REPORT-All-Tasks.result | 94 ++--- .../regression-suite/900-Moz-REPORT.result | 384 +++++++++--------- 7 files changed, 324 insertions(+), 314 deletions(-) diff --git a/inc/caldav-REPORT-calquery.php b/inc/caldav-REPORT-calquery.php index af5f7e92..4c63eb6e 100644 --- a/inc/caldav-REPORT-calquery.php +++ b/inc/caldav-REPORT-calquery.php @@ -230,7 +230,15 @@ function BuildSqlFilter( $filter ) { $responses = array(); -$where = " WHERE caldav_data.dav_name ~ ".qpg("^".$request->path)." "; +/** +* FIXME: Once we are past DB version 1.2.1 we can change this query more radically. The best performance to +* date seems to be: +* SELECT caldav_data.*,calendar_item.* FROM collection JOIN calendar_item USING (collection_id,user_no) +* JOIN caldav_data USING (dav_id) WHERE collection.dav_name = '/user1/home/' +* AND caldav_data.caldav_type = 'VEVENT' ORDER BY caldav_data.user_no, caldav_data.dav_name; +*/ + +$where = " WHERE caldav_data.user_no = $request->user_no AND caldav_data.dav_name ~ ".qpg("^".$request->path)." "; if ( is_array($qry_filters) ) { dbg_log_array( "calquery", "qry_filters", $qry_filters, true ); $where .= BuildSqlFilter( $qry_filters ); @@ -243,7 +251,9 @@ if ( isset($c->hide_TODO) && $c->hide_TODO && ! $request->AllowedTo('all') ) { $where .= "AND caldav_data.caldav_type NOT IN ('VTODO') "; } -$qry = new PgQuery( "SELECT * FROM caldav_data INNER JOIN calendar_item USING(user_no, dav_name)". $where . " ORDER BY caldav_data.user_no, caldav_data.dav_name" ); +$sql = "SELECT * FROM caldav_data INNER JOIN calendar_item USING(dav_id,user_no,dav_name)". $where; +if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY dav_id"; +$qry = new PgQuery( $sql ); if ( $qry->Exec("calquery",__LINE__,__FILE__) && $qry->rows > 0 ) { while( $calendar_object = $qry->Fetch() ) { if ( !$need_post_filter || apply_filter( $qry_filters, $calendar_object ) ) { diff --git a/testing/tests/regression-suite/105-Evo-REPORT-1.result b/testing/tests/regression-suite/105-Evo-REPORT-1.result index 71e5b574..d1b8ec66 100644 --- a/testing/tests/regression-suite/105-Evo-REPORT-1.result +++ b/testing/tests/regression-suite/105-Evo-REPORT-1.result @@ -1,21 +1,12 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "278939915085a441aa95fa319fc3bb3a" +ETag: "ca51ab493acbf1f9847c2cd95ef33026" Content-Length: 552 Content-Type: text/xml; charset="utf-8" - - /caldav.php/user1/home/20061101T073004Z.ics - - - "c3658901fd4689d4a1e1d6f08601ef4f" - - HTTP/1.1 200 OK - - /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics @@ -25,4 +16,13 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK + + /caldav.php/user1/home/20061101T073004Z.ics + + + "c3658901fd4689d4a1e1d6f08601ef4f" + + HTTP/1.1 200 OK + + diff --git a/testing/tests/regression-suite/107-Evo-REPORT-1.result b/testing/tests/regression-suite/107-Evo-REPORT-1.result index e7f99b77..effa59ec 100644 --- a/testing/tests/regression-suite/107-Evo-REPORT-1.result +++ b/testing/tests/regression-suite/107-Evo-REPORT-1.result @@ -1,21 +1,12 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "83ce5baee07017b4b40318062103c2ce" +ETag: "060f992b9ee715662940929074dc1f57" Content-Length: 530 Content-Type: text/xml; charset="utf-8" - - /user1/home/20061101T073004Z.ics - - - "c3658901fd4689d4a1e1d6f08601ef4f" - - HTTP/1.1 200 OK - - /user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics @@ -25,4 +16,13 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK + + /user1/home/20061101T073004Z.ics + + + "c3658901fd4689d4a1e1d6f08601ef4f" + + HTTP/1.1 200 OK + + diff --git a/testing/tests/regression-suite/108-Evo-REPORT-1.result b/testing/tests/regression-suite/108-Evo-REPORT-1.result index 9038e8bc..7d995359 100644 --- a/testing/tests/regression-suite/108-Evo-REPORT-1.result +++ b/testing/tests/regression-suite/108-Evo-REPORT-1.result @@ -1,21 +1,12 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "9f89b851745eccbc4d1da3bf3f0bb9c7" +ETag: "d937ad45e618e42c4cd4a78932f2debd" Content-Length: 570 Content-Type: text/xml; charset="utf-8" - - /calendar/caldav.php/user1/home/20061101T073004Z.ics - - - "c3658901fd4689d4a1e1d6f08601ef4f" - - HTTP/1.1 200 OK - - /calendar/caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics @@ -25,4 +16,13 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK + + /calendar/caldav.php/user1/home/20061101T073004Z.ics + + + "c3658901fd4689d4a1e1d6f08601ef4f" + + HTTP/1.1 200 OK + + diff --git a/testing/tests/regression-suite/203-Moz-REPORT-2.result b/testing/tests/regression-suite/203-Moz-REPORT-2.result index c1f39df6..4e4e9650 100644 --- a/testing/tests/regression-suite/203-Moz-REPORT-2.result +++ b/testing/tests/regression-suite/203-Moz-REPORT-2.result @@ -1,12 +1,54 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "6df625ac708940d88e7e400fa0cd2092" +ETag: "8934fd37910f21f30796db44716c7ca5" Content-Length: 2390 Content-Type: text/xml; charset="utf-8" + + /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics + + + BEGIN:VCALENDAR +CALSCALE:GREGORIAN +PRODID:-//mulberrymail.com//Mulberry v4.0//EN +VERSION:2.0 +BEGIN:VTIMEZONE +LAST-MODIFIED:20040110T032845Z +TZID:New Zealand Standard Time +X-LIC-LOCATION:Pacific/Auckland +BEGIN:DAYLIGHT +DTSTART:20000404T020000 +RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 +TZNAME:NZDT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +END:DAYLIGHT +BEGIN:STANDARD +DTSTART:20001026T020000 +RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=10 +TZNAME:NZST +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +END:STANDARD +END:VTIMEZONE +BEGIN:VEVENT +DTSTAMP:20061102T090217Z +DTSTART;TZID=New Zealand Standard Time:20061102T123000 +DURATION:PT1H +LAST-MODIFIED:20061104T002921Z +SEQUENCE:1 +SUMMARY:Lunch with David +UID:5A55230C8866CA8D3D325F3A@CA1CBED546AAE36FF3BC722E +END:VEVENT +END:VCALENDAR + + + HTTP/1.1 200 OK + + /caldav.php/user1/home/20061101T073004Z.ics @@ -51,48 +93,6 @@ RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 END:DAYLIGHT END:VTIMEZONE END:VCALENDAR - - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics - - - BEGIN:VCALENDAR -CALSCALE:GREGORIAN -PRODID:-//mulberrymail.com//Mulberry v4.0//EN -VERSION:2.0 -BEGIN:VTIMEZONE -LAST-MODIFIED:20040110T032845Z -TZID:New Zealand Standard Time -X-LIC-LOCATION:Pacific/Auckland -BEGIN:DAYLIGHT -DTSTART:20000404T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 -TZNAME:NZDT -TZOFFSETFROM:+1200 -TZOFFSETTO:+1300 -END:DAYLIGHT -BEGIN:STANDARD -DTSTART:20001026T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=10 -TZNAME:NZST -TZOFFSETFROM:+1300 -TZOFFSETTO:+1200 -END:STANDARD -END:VTIMEZONE -BEGIN:VEVENT -DTSTAMP:20061102T090217Z -DTSTART;TZID=New Zealand Standard Time:20061102T123000 -DURATION:PT1H -LAST-MODIFIED:20061104T002921Z -SEQUENCE:1 -SUMMARY:Lunch with David -UID:5A55230C8866CA8D3D325F3A@CA1CBED546AAE36FF3BC722E -END:VEVENT -END:VCALENDAR HTTP/1.1 200 OK diff --git a/testing/tests/regression-suite/231-Moz-REPORT-All-Tasks.result b/testing/tests/regression-suite/231-Moz-REPORT-All-Tasks.result index ce3399e9..d02a0701 100644 --- a/testing/tests/regression-suite/231-Moz-REPORT-All-Tasks.result +++ b/testing/tests/regression-suite/231-Moz-REPORT-All-Tasks.result @@ -1,58 +1,12 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "4a177807973966b4873ffa2f0080b4a1" +ETag: "532e1a9f851cc9b778320e16e9936baa" Content-Length: 4224 Content-Type: text/xml; charset="utf-8" - - /calendar/caldav.php/user1/home/0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics - - - "00ad5eb1eb5507884710b0b66aa5d5c4" - BEGIN:VCALENDAR -PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:/mozilla.org/20070129_1/Antarctica/McMurdo -X-LIC-LOCATION:Antarctica/McMurdo -BEGIN:STANDARD -TZOFFSETFROM:+1300 -TZOFFSETTO:+1200 -TZNAME:NZST -DTSTART:19700315T030000 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 -END:STANDARD -BEGIN:DAYLIGHT -TZOFFSETFROM:+1200 -TZOFFSETTO:+1300 -TZNAME:NZDT -DTSTART:19701004T020000 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VTODO -CREATED:20070805T201647Z -LAST-MODIFIED:20070805T201834Z -DTSTAMP:20070805T201647Z -UID:0575d895-a006-4ed8-9be6-0d1b6b6b1f96 -SUMMARY:Due 7/8/7 16:30\, completed -STATUS:COMPLETED -DUE;TZID=/mozilla.org/20070129_1/Antarctica/McMurdo:20070807T163000 -COMPLETED:20070805T201737Z -PERCENT-COMPLETE:100 -X-MOZ-LOCATIONPATH:0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics -DESCRIPTION:Due on 7/8/7 at 4:30pm\, but completed alread on 6/8/7 -CATEGORIES:Projects -END:VTODO -END:VCALENDAR - - - HTTP/1.1 200 OK - - /calendar/caldav.php/user1/home/2178279a-aec2-471f-832d-1f6df6203f2f.ics @@ -98,6 +52,52 @@ DESCRIPTION:This task is in progress (50% complete) and has not been cancelled. END:VTODO END:VCALENDAR + + + HTTP/1.1 200 OK + + + + /calendar/caldav.php/user1/home/0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics + + + "00ad5eb1eb5507884710b0b66aa5d5c4" + BEGIN:VCALENDAR +PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN +VERSION:2.0 +BEGIN:VTIMEZONE +TZID:/mozilla.org/20070129_1/Antarctica/McMurdo +X-LIC-LOCATION:Antarctica/McMurdo +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +TZNAME:NZST +DTSTART:19700315T030000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 +END:STANDARD +BEGIN:DAYLIGHT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +TZNAME:NZDT +DTSTART:19701004T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 +END:DAYLIGHT +END:VTIMEZONE +BEGIN:VTODO +CREATED:20070805T201647Z +LAST-MODIFIED:20070805T201834Z +DTSTAMP:20070805T201647Z +UID:0575d895-a006-4ed8-9be6-0d1b6b6b1f96 +SUMMARY:Due 7/8/7 16:30\, completed +STATUS:COMPLETED +DUE;TZID=/mozilla.org/20070129_1/Antarctica/McMurdo:20070807T163000 +COMPLETED:20070805T201737Z +PERCENT-COMPLETE:100 +X-MOZ-LOCATIONPATH:0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics +DESCRIPTION:Due on 7/8/7 at 4:30pm\, but completed alread on 6/8/7 +CATEGORIES:Projects +END:VTODO +END:VCALENDAR HTTP/1.1 200 OK diff --git a/testing/tests/regression-suite/900-Moz-REPORT.result b/testing/tests/regression-suite/900-Moz-REPORT.result index 60c82457..57c0603b 100644 --- a/testing/tests/regression-suite/900-Moz-REPORT.result +++ b/testing/tests/regression-suite/900-Moz-REPORT.result @@ -1,7 +1,7 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "fea25d8795124283031b5cb5ecb29b04" +ETag: "66f362ee8f18d43b5d6c28a036289067" Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked @@ -9,6 +9,96 @@ Content-Type: text/xml; charset="utf-8" + + /caldav.php/user1/home/4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics + + + BEGIN:VCALENDAR +PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN +VERSION:2.0 +BEGIN:VEVENT +CREATED:20061120T041336Z +LAST-MODIFIED:20061120T041709Z +DTSTAMP:20061120T041709Z +UID:4aaf8f37-f232-4c8e-a72e-e171d4c4fe54 +SUMMARY:Weekly Project Meeting +PRIORITY:0 +CLASS:PUBLIC +RRULE:FREQ=WEEKLY;COUNT=26;INTERVAL=1;BYDAY=TH +DTSTART;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061102T100000 +DTEND;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061102T110000 +CATEGORIES:Projects +X-MOZ-LOCATIONPATH:4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics +END:VEVENT +BEGIN:VTIMEZONE +TZID:/mozilla.org/20050126_1/Pacific/Auckland +X-LIC-LOCATION:Pacific/Auckland +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +TZNAME:NZST +DTSTART:19700315T030000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 +END:STANDARD +BEGIN:DAYLIGHT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +TZNAME:NZDT +DTSTART:19701004T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 +END:DAYLIGHT +END:VTIMEZONE +END:VCALENDAR + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/9d050be7-8a02-4355-8ed3-02a9fc5f473f.ics + + + BEGIN:VCALENDAR +PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN +VERSION:2.0 +BEGIN:VEVENT +CREATED:20061223T032350Z +LAST-MODIFIED:20061223T033144Z +DTSTAMP:20061223T033144Z +UID:9d050be7-8a02-4355-8ed3-02a9fc5f473f +SUMMARY:Confidential Event +PRIORITY:0 +STATUS:CONFIRMED +CLASS:CONFIDENTIAL +DTSTART;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T160000 +DTEND;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T180000 +X-MOZ-LOCATIONPATH:9d050be7-8a02-4355-8ed3-02a9fc5f473f.ics +LOCATION:In a confidential place +END:VEVENT +BEGIN:VTIMEZONE +TZID:/mozilla.org/20050126_1/Antarctica/McMurdo +X-LIC-LOCATION:Antarctica/McMurdo +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +TZNAME:NZST +DTSTART:19700315T030000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 +END:STANDARD +BEGIN:DAYLIGHT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +TZNAME:NZDT +DTSTART:19701004T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 +END:DAYLIGHT +END:VTIMEZONE +END:VCALENDAR + + + HTTP/1.1 200 OK + + /caldav.php/user1/home/1906b3ca-4890-468a-9b58-1de74bf2c716.ics @@ -56,45 +146,94 @@ END:VCALENDAR - /caldav.php/user1/home/4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics + /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics - BEGIN:VCALENDAR -PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN -VERSION:2.0 -BEGIN:VEVENT -CREATED:20061120T041336Z -LAST-MODIFIED:20061120T041709Z -DTSTAMP:20061120T041709Z -UID:4aaf8f37-f232-4c8e-a72e-e171d4c4fe54 -SUMMARY:Weekly Project Meeting -PRIORITY:0 -CLASS:PUBLIC -RRULE:FREQ=WEEKLY;COUNT=26;INTERVAL=1;BYDAY=TH -DTSTART;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061102T100000 -DTEND;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061102T110000 -CATEGORIES:Projects -X-MOZ-LOCATIONPATH:4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics -END:VEVENT -BEGIN:VTIMEZONE -TZID:/mozilla.org/20050126_1/Pacific/Auckland -X-LIC-LOCATION:Pacific/Auckland -BEGIN:STANDARD -TZOFFSETFROM:+1300 -TZOFFSETTO:+1200 -TZNAME:NZST -DTSTART:19700315T030000 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 -END:STANDARD -BEGIN:DAYLIGHT -TZOFFSETFROM:+1200 -TZOFFSETTO:+1300 -TZNAME:NZDT -DTSTART:19701004T020000 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 -END:DAYLIGHT -END:VTIMEZONE -END:VCALENDAR + BEGIN:VCALENDAR +PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN +VERSION:2.0 +BEGIN:VEVENT +CREATED:20061223T051646Z +LAST-MODIFIED:20061223T051713Z +DTSTAMP:20061223T051713Z +UID:fbd57454-d966-4a14-8341-abe1edb1ae66 +SUMMARY:Tentative Event +STATUS:TENTATIVE +CLASS:PUBLIC +DTSTART;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T190000 +DTEND;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T210000 +X-MOZ-LOCATIONPATH:fbd57454-d966-4a14-8341-abe1edb1ae66.ics +LOCATION:Never never land +END:VEVENT +BEGIN:VTIMEZONE +TZID:/mozilla.org/20050126_1/Antarctica/McMurdo +X-LIC-LOCATION:Antarctica/McMurdo +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +TZNAME:NZST +DTSTART:19700315T030000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 +END:STANDARD +BEGIN:DAYLIGHT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +TZNAME:NZDT +DTSTART:19701004T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 +END:DAYLIGHT +END:VTIMEZONE +END:VCALENDAR + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/e70576e9-c1e0-431e-a507-0386fd82f223.ics + + + BEGIN:VCALENDAR +PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN +VERSION:2.0 +BEGIN:VTIMEZONE +TZID:/mozilla.org/20070129_1/Antarctica/McMurdo +X-LIC-LOCATION:Antarctica/McMurdo +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +TZNAME:NZST +DTSTART:19700315T030000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 +END:STANDARD +BEGIN:DAYLIGHT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +TZNAME:NZDT +DTSTART:19701004T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 +END:DAYLIGHT +END:VTIMEZONE +BEGIN:VEVENT +CREATED:20071203T202630Z +LAST-MODIFIED:20071203T202834Z +DTSTAMP:20071203T202630Z +UID:e70576e9-c1e0-431e-a507-0386fd82f223 +SUMMARY:Morning Meeting +RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,TH +DTSTART;TZID=/mozilla.org/20070129_1/Antarctica/McMurdo:20071211T074500 +DTEND;TZID=/mozilla.org/20070129_1/Antarctica/McMurdo:20071211T083000 +X-MOZ-LOCATIONPATH:e70576e9-c1e0-431e-a507-0386fd82f223.ics +LOCATION:Suzies Coffee Lounge +DESCRIPTION:Twice-weekly breakfast meeting +CATEGORIES:Business +BEGIN:VALARM +TRIGGER;VALUE=DURATION:-PT10M +DESCRIPTION:Mozilla Alarm: Morning Meeting +ACTION:DISPLAY +END:VALARM +END:VEVENT +END:VCALENDAR HTTP/1.1 200 OK @@ -141,45 +280,23 @@ END:VCALENDAR - /caldav.php/user1/home/9d050be7-8a02-4355-8ed3-02a9fc5f473f.ics + /caldav.php/user1/home/da81c0ee-7871-11db-c6d6-f6927c144649.ics - BEGIN:VCALENDAR -PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN -VERSION:2.0 -BEGIN:VEVENT -CREATED:20061223T032350Z -LAST-MODIFIED:20061223T033144Z -DTSTAMP:20061223T033144Z -UID:9d050be7-8a02-4355-8ed3-02a9fc5f473f -SUMMARY:Confidential Event -PRIORITY:0 -STATUS:CONFIRMED -CLASS:CONFIDENTIAL -DTSTART;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T160000 -DTEND;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T180000 -X-MOZ-LOCATIONPATH:9d050be7-8a02-4355-8ed3-02a9fc5f473f.ics -LOCATION:In a confidential place -END:VEVENT -BEGIN:VTIMEZONE -TZID:/mozilla.org/20050126_1/Antarctica/McMurdo -X-LIC-LOCATION:Antarctica/McMurdo -BEGIN:STANDARD -TZOFFSETFROM:+1300 -TZOFFSETTO:+1200 -TZNAME:NZST -DTSTART:19700315T030000 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 -END:STANDARD -BEGIN:DAYLIGHT -TZOFFSETFROM:+1200 -TZOFFSETTO:+1300 -TZNAME:NZDT -DTSTART:19701004T020000 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 -END:DAYLIGHT -END:VTIMEZONE -END:VCALENDAR + BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//PYVOBJECT//NONSGML Version 1//EN +BEGIN:VEVENT +UID:da81c0ee-7871-11db-c6d6-f6927c144649 +DTSTART:20061103T073000 +DTEND:20061103T093000 +DESCRIPTION: +LOCATION:Olivia's +RRULE:FREQ=MONTHLY +STATUS:CONFIRMED +SUMMARY:Morning Mgmt Mtg +END:VEVENT +END:VCALENDAR HTTP/1.1 200 OK @@ -235,123 +352,6 @@ ATTACH;VALUE=URI:Basso END:VALARM END:VEVENT END:VCALENDAR - - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/da81c0ee-7871-11db-c6d6-f6927c144649.ics - - - BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//PYVOBJECT//NONSGML Version 1//EN -BEGIN:VEVENT -UID:da81c0ee-7871-11db-c6d6-f6927c144649 -DTSTART:20061103T073000 -DTEND:20061103T093000 -DESCRIPTION: -LOCATION:Olivia's -RRULE:FREQ=MONTHLY -STATUS:CONFIRMED -SUMMARY:Morning Mgmt Mtg -END:VEVENT -END:VCALENDAR - - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/e70576e9-c1e0-431e-a507-0386fd82f223.ics - - - BEGIN:VCALENDAR -PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:/mozilla.org/20070129_1/Antarctica/McMurdo -X-LIC-LOCATION:Antarctica/McMurdo -BEGIN:STANDARD -TZOFFSETFROM:+1300 -TZOFFSETTO:+1200 -TZNAME:NZST -DTSTART:19700315T030000 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 -END:STANDARD -BEGIN:DAYLIGHT -TZOFFSETFROM:+1200 -TZOFFSETTO:+1300 -TZNAME:NZDT -DTSTART:19701004T020000 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -CREATED:20071203T202630Z -LAST-MODIFIED:20071203T202834Z -DTSTAMP:20071203T202630Z -UID:e70576e9-c1e0-431e-a507-0386fd82f223 -SUMMARY:Morning Meeting -RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,TH -DTSTART;TZID=/mozilla.org/20070129_1/Antarctica/McMurdo:20071211T074500 -DTEND;TZID=/mozilla.org/20070129_1/Antarctica/McMurdo:20071211T083000 -X-MOZ-LOCATIONPATH:e70576e9-c1e0-431e-a507-0386fd82f223.ics -LOCATION:Suzies Coffee Lounge -DESCRIPTION:Twice-weekly breakfast meeting -CATEGORIES:Business -BEGIN:VALARM -TRIGGER;VALUE=DURATION:-PT10M -DESCRIPTION:Mozilla Alarm: Morning Meeting -ACTION:DISPLAY -END:VALARM -END:VEVENT -END:VCALENDAR - - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics - - - BEGIN:VCALENDAR -PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN -VERSION:2.0 -BEGIN:VEVENT -CREATED:20061223T051646Z -LAST-MODIFIED:20061223T051713Z -DTSTAMP:20061223T051713Z -UID:fbd57454-d966-4a14-8341-abe1edb1ae66 -SUMMARY:Tentative Event -STATUS:TENTATIVE -CLASS:PUBLIC -DTSTART;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T190000 -DTEND;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T210000 -X-MOZ-LOCATIONPATH:fbd57454-d966-4a14-8341-abe1edb1ae66.ics -LOCATION:Never never land -END:VEVENT -BEGIN:VTIMEZONE -TZID:/mozilla.org/20050126_1/Antarctica/McMurdo -X-LIC-LOCATION:Antarctica/McMurdo -BEGIN:STANDARD -TZOFFSETFROM:+1300 -TZOFFSETTO:+1200 -TZNAME:NZST -DTSTART:19700315T030000 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 -END:STANDARD -BEGIN:DAYLIGHT -TZOFFSETFROM:+1200 -TZOFFSETTO:+1300 -TZNAME:NZDT -DTSTART:19701004T020000 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 -END:DAYLIGHT -END:VTIMEZONE -END:VCALENDAR HTTP/1.1 200 OK From eaf8fa3fa57ffcefbdf1835ced096aeb6fd669b8 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 24 Jan 2008 22:35:00 +1300 Subject: [PATCH 26/65] Allow for persistent connections to the auth DB also. --- inc/auth-functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/auth-functions.php b/inc/auth-functions.php index 09c12765..47e18eac 100644 --- a/inc/auth-functions.php +++ b/inc/auth-functions.php @@ -142,7 +142,8 @@ function UpdateUserFromExternal( &$usr ) { function AuthExternalAWL( $username, $password ) { global $c; - $authconn = pg_Connect($c->authenticate_hook['config']['connection']); + $persistent = isset($c->authenticate_hook['config']['use_persistent']) && $c->authenticate_hook['config']['use_persistent']; + $authconn = ( $persistent ? pg_pConnect($c->authenticate_hook['config']['connection']) : pg_Connect($c->authenticate_hook['config']['connection'])); if ( ! $authconn ) { echo <<Database Connection Failure From d8bf50896e7d53bc5bd379e0629b9a190a072df4 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 24 Jan 2008 22:36:13 +1300 Subject: [PATCH 27/65] Performance improvement and resultant reordering of freebusy query results. --- inc/caldav-REPORT-freebusy.php | 3 ++- .../830-Spec-FREEBUSY-1.result | 12 +++++------ .../834-Spec-FREEBUSY-1.result | 20 +++++++++---------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/inc/caldav-REPORT-freebusy.php b/inc/caldav-REPORT-freebusy.php index 9f0145f3..7108cf33 100644 --- a/inc/caldav-REPORT-freebusy.php +++ b/inc/caldav-REPORT-freebusy.php @@ -33,7 +33,8 @@ $busy_tentative = array(); $sql = "SELECT caldav_data.caldav_data, calendar_item.rrule, calendar_item.transp, calendar_item.status, "; $sql .= "to_char(calendar_item.dtstart at time zone 'GMT',".iCalendar::SqlDateFormat().") AS start, "; $sql .= "to_char(calendar_item.dtend at time zone 'GMT',".iCalendar::SqlDateFormat().") AS finish "; -$sql .= "FROM caldav_data INNER JOIN calendar_item USING(user_no, dav_name)".$where." ORDER BY dtstart, dtend"; +$sql .= "FROM caldav_data INNER JOIN calendar_item USING(dav_id,user_no,dav_name)".$where; +if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY dav_id"; $qry = new PgQuery( $sql, "^".$request->path.$request->DepthRegexTail() ); if ( $qry->Exec("REPORT",__LINE__,__FILE__) && $qry->rows > 0 ) { while( $calendar_object = $qry->Fetch() ) { diff --git a/testing/tests/regression-suite/830-Spec-FREEBUSY-1.result b/testing/tests/regression-suite/830-Spec-FREEBUSY-1.result index a50257e9..6c3e0873 100644 --- a/testing/tests/regression-suite/830-Spec-FREEBUSY-1.result +++ b/testing/tests/regression-suite/830-Spec-FREEBUSY-1.result @@ -12,6 +12,7 @@ DTSTAMP:yyyymmddThhmmssZ DTSTART:20061004T140000Z DTEND:20070105T220000Z FREEBUSY;FBTYPE=BUSY-TENTATIVE:20061223T060000/20061223T080000 +FREEBUSY:20061101T233000/20061102T003000 FREEBUSY:20061031T210000/20061031T220000 FREEBUSY:20061102T210000/20061102T220000 FREEBUSY:20061109T210000/20061109T220000 @@ -23,16 +24,15 @@ FREEBUSY:20061214T210000/20061214T220000 FREEBUSY:20061221T210000/20061221T220000 FREEBUSY:20061228T210000/20061228T220000 FREEBUSY:20070104T210000/20070104T220000 -FREEBUSY:20061101T233000/20061102T003000 -FREEBUSY:20061102T183000/20061102T203000 -FREEBUSY:20061202T183000/20061202T203000 -FREEBUSY:20070102T183000/20070102T203000 +FREEBUSY:20061223T030000/20061223T050000 +FREEBUSY:20061223T000000/20061223T020000 FREEBUSY:20061103T030000/20061103T044500 FREEBUSY:20061117T030000/20061117T044500 FREEBUSY:20061201T030000/20061201T044500 FREEBUSY:20061215T030000/20061215T044500 FREEBUSY:20061229T030000/20061229T044500 -FREEBUSY:20061223T000000/20061223T020000 -FREEBUSY:20061223T030000/20061223T050000 +FREEBUSY:20061102T183000/20061102T203000 +FREEBUSY:20061202T183000/20061202T203000 +FREEBUSY:20070102T183000/20070102T203000 END:VFREEBUSY END:VCALENDAR diff --git a/testing/tests/regression-suite/834-Spec-FREEBUSY-1.result b/testing/tests/regression-suite/834-Spec-FREEBUSY-1.result index 6995ea54..257884d8 100644 --- a/testing/tests/regression-suite/834-Spec-FREEBUSY-1.result +++ b/testing/tests/regression-suite/834-Spec-FREEBUSY-1.result @@ -12,6 +12,7 @@ DTSTAMP:yyyymmddThhmmssZ DTSTART:20061001T000000Z DTEND:20070630T235959Z FREEBUSY;FBTYPE=BUSY-TENTATIVE:20061223T060000/20061223T080000 +FREEBUSY:20061101T233000/20061102T003000 FREEBUSY:20061031T210000/20061031T220000 FREEBUSY:20061102T210000/20061102T220000 FREEBUSY:20061109T210000/20061109T220000 @@ -39,15 +40,7 @@ FREEBUSY:20070405T210000/20070405T220000 FREEBUSY:20070412T210000/20070412T220000 FREEBUSY:20070419T210000/20070419T220000 FREEBUSY:20070426T210000/20070426T220000 -FREEBUSY:20061101T233000/20061102T003000 -FREEBUSY:20061102T183000/20061102T203000 -FREEBUSY:20061202T183000/20061202T203000 -FREEBUSY:20070102T183000/20070102T203000 -FREEBUSY:20070202T183000/20070202T203000 -FREEBUSY:20070302T183000/20070302T203000 -FREEBUSY:20070402T183000/20070402T203000 -FREEBUSY:20070502T183000/20070502T203000 -FREEBUSY:20070602T183000/20070602T203000 +FREEBUSY:20061223T030000/20061223T050000 FREEBUSY:20061103T030000/20061103T044500 FREEBUSY:20061117T030000/20061117T044500 FREEBUSY:20061201T030000/20061201T044500 @@ -66,6 +59,13 @@ FREEBUSY:20070518T030000/20070518T044500 FREEBUSY:20070601T030000/20070601T044500 FREEBUSY:20070615T030000/20070615T044500 FREEBUSY:20070629T030000/20070629T044500 -FREEBUSY:20061223T030000/20061223T050000 +FREEBUSY:20061102T183000/20061102T203000 +FREEBUSY:20061202T183000/20061202T203000 +FREEBUSY:20070102T183000/20070102T203000 +FREEBUSY:20070202T183000/20070202T203000 +FREEBUSY:20070302T183000/20070302T203000 +FREEBUSY:20070402T183000/20070402T203000 +FREEBUSY:20070502T183000/20070502T203000 +FREEBUSY:20070602T183000/20070602T203000 END:VFREEBUSY END:VCALENDAR From d331585080ee0b0bf7b2d38d2cce30a5e560c476 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 24 Jan 2008 22:40:56 +1300 Subject: [PATCH 28/65] Remove temporary DB patch which accidentally was committed. --- testing/run_regressions.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/testing/run_regressions.sh b/testing/run_regressions.sh index 25c382bd..464b94fa 100755 --- a/testing/run_regressions.sh +++ b/testing/run_regressions.sh @@ -70,8 +70,6 @@ TEST="Load-Sample-Data" psql -q -f "../dba/sample-data.sql" "${DBNAME}" >"${RESULTS}/${TEST}" 2>&1 check_result "${TEST}" -# psql -q -f "../dba/patches/1.1.12.sql" "${DBNAME}" - TSTART="`date +%s`" TCOUNT=0 From 3b0b31df18193a132439973290e4752db8b26c05 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 24 Jan 2008 22:43:53 +1300 Subject: [PATCH 29/65] Note $c->strict_result_ordering configuration option. --- config/other-config.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/other-config.php b/config/other-config.php index 1cc92414..c0b45fd7 100644 --- a/config/other-config.php +++ b/config/other-config.php @@ -84,3 +84,10 @@ // $c->schema_patch // $c->schema_version +/** +* This property is used to enforce regular ordering of query results so +* that the regression test output is deterministically ordered. In +* real life this is not important, and it is a performance hit, so it +* should not usually be enabled anywhere else. +*/ +// $c->strict_result_ordering = boolean; From bae86da4f7e99ce40f51613659bd5bc3d2a08227 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 25 Jan 2008 07:58:30 +1300 Subject: [PATCH 30/65] Performance fixes to freebusy and results ordering change. --- inc/freebusy-GET.php | 8 +++++--- .../regression-suite/832-freebusy.result | 20 +++++++++---------- .../regression-suite/833-freebusy.result | 20 +++++++++---------- .../regression-suite/835-freebusy.result | 18 ++++++++--------- .../regression-suite/836-freebusy.result | 18 ++++++++--------- 5 files changed, 43 insertions(+), 41 deletions(-) diff --git a/inc/freebusy-GET.php b/inc/freebusy-GET.php index 3dbcc392..9319db28 100644 --- a/inc/freebusy-GET.php +++ b/inc/freebusy-GET.php @@ -19,7 +19,6 @@ else { $finish = date( "Ymd\THis", time() + (86400 * 200) ); } - if ( isset($request->by_email) ) { $where = "WHERE caldav_data.user_no = $request->user_no "; } @@ -31,14 +30,17 @@ $where .= "AND dtstart <= '$finish'::timestamp with time zone "; $where .= "AND caldav_data.caldav_type IN ( 'VEVENT', 'VFREEBUSY' ) "; $where .= "AND (calendar_item.transp != 'TRANSPARENT' OR calendar_item.transp IS NULL) "; $where .= "AND (calendar_item.status != 'CANCELLED' OR calendar_item.status IS NULL) "; -$where .= "AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL OR get_permissions($session->user_no,caldav_data.user_no) ~ 'A') "; // Must have 'all' permissions to see confidential items +if ( ! $request->AllowedTo('all') ) { + $where .= "AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL) "; +} $busy = array(); $busy_tentative = array(); $sql = "SELECT caldav_data.caldav_data, calendar_item.rrule, calendar_item.transp, calendar_item.status, "; $sql .= "to_char(calendar_item.dtstart at time zone 'GMT',".iCalendar::SqlDateFormat().") AS start, "; $sql .= "to_char(calendar_item.dtend at time zone 'GMT',".iCalendar::SqlDateFormat().") AS finish "; -$sql .= "FROM caldav_data INNER JOIN calendar_item USING(user_no, dav_name) $where ORDER BY dtstart, dtend"; +$sql .= "FROM caldav_data INNER JOIN calendar_item USING(dav_id,user_no,dav_name)".$where; +if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY dav_id"; // echo $sql. "\n"; $qry = new PgQuery( $sql ); if ( $qry->Exec("freebusy",__LINE__,__FILE__) && $qry->rows > 0 ) { diff --git a/testing/tests/regression-suite/832-freebusy.result b/testing/tests/regression-suite/832-freebusy.result index efd7e369..8dd976d3 100644 --- a/testing/tests/regression-suite/832-freebusy.result +++ b/testing/tests/regression-suite/832-freebusy.result @@ -11,6 +11,7 @@ DTSTAMP:yyyymmddThhmmssZ DTSTART:yyyymmddThhmmss DTEND:yyyymmddThhmmss FREEBUSY;FBTYPE=BUSY-TENTATIVE:20061223T060000/20061223T080000 +FREEBUSY:20061101T233000/20061102T003000 FREEBUSY:20061031T210000/20061031T220000 FREEBUSY:20061102T210000/20061102T220000 FREEBUSY:20061109T210000/20061109T220000 @@ -38,14 +39,8 @@ FREEBUSY:20070405T210000/20070405T220000 FREEBUSY:20070412T210000/20070412T220000 FREEBUSY:20070419T210000/20070419T220000 FREEBUSY:20070426T210000/20070426T220000 -FREEBUSY:20061101T233000/20061102T003000 -FREEBUSY:20061202T183000/20061202T203000 -FREEBUSY:20070102T183000/20070102T203000 -FREEBUSY:20070202T183000/20070202T203000 -FREEBUSY:20070302T183000/20070302T203000 -FREEBUSY:20070402T183000/20070402T203000 -FREEBUSY:20070502T183000/20070502T203000 -FREEBUSY:20070602T183000/20070602T203000 +FREEBUSY:20061223T030000/20061223T050000 +FREEBUSY:20061223T000000/20061223T020000 FREEBUSY:20061117T030000/20061117T044500 FREEBUSY:20061201T030000/20061201T044500 FREEBUSY:20061215T030000/20061215T044500 @@ -63,7 +58,12 @@ FREEBUSY:20070518T030000/20070518T044500 FREEBUSY:20070601T030000/20070601T044500 FREEBUSY:20070615T030000/20070615T044500 FREEBUSY:20070629T030000/20070629T044500 -FREEBUSY:20061223T000000/20061223T020000 -FREEBUSY:20061223T030000/20061223T050000 +FREEBUSY:20061202T183000/20061202T203000 +FREEBUSY:20070102T183000/20070102T203000 +FREEBUSY:20070202T183000/20070202T203000 +FREEBUSY:20070302T183000/20070302T203000 +FREEBUSY:20070402T183000/20070402T203000 +FREEBUSY:20070502T183000/20070502T203000 +FREEBUSY:20070602T183000/20070602T203000 END:VFREEBUSY END:VCALENDAR diff --git a/testing/tests/regression-suite/833-freebusy.result b/testing/tests/regression-suite/833-freebusy.result index efd7e369..8dd976d3 100644 --- a/testing/tests/regression-suite/833-freebusy.result +++ b/testing/tests/regression-suite/833-freebusy.result @@ -11,6 +11,7 @@ DTSTAMP:yyyymmddThhmmssZ DTSTART:yyyymmddThhmmss DTEND:yyyymmddThhmmss FREEBUSY;FBTYPE=BUSY-TENTATIVE:20061223T060000/20061223T080000 +FREEBUSY:20061101T233000/20061102T003000 FREEBUSY:20061031T210000/20061031T220000 FREEBUSY:20061102T210000/20061102T220000 FREEBUSY:20061109T210000/20061109T220000 @@ -38,14 +39,8 @@ FREEBUSY:20070405T210000/20070405T220000 FREEBUSY:20070412T210000/20070412T220000 FREEBUSY:20070419T210000/20070419T220000 FREEBUSY:20070426T210000/20070426T220000 -FREEBUSY:20061101T233000/20061102T003000 -FREEBUSY:20061202T183000/20061202T203000 -FREEBUSY:20070102T183000/20070102T203000 -FREEBUSY:20070202T183000/20070202T203000 -FREEBUSY:20070302T183000/20070302T203000 -FREEBUSY:20070402T183000/20070402T203000 -FREEBUSY:20070502T183000/20070502T203000 -FREEBUSY:20070602T183000/20070602T203000 +FREEBUSY:20061223T030000/20061223T050000 +FREEBUSY:20061223T000000/20061223T020000 FREEBUSY:20061117T030000/20061117T044500 FREEBUSY:20061201T030000/20061201T044500 FREEBUSY:20061215T030000/20061215T044500 @@ -63,7 +58,12 @@ FREEBUSY:20070518T030000/20070518T044500 FREEBUSY:20070601T030000/20070601T044500 FREEBUSY:20070615T030000/20070615T044500 FREEBUSY:20070629T030000/20070629T044500 -FREEBUSY:20061223T000000/20061223T020000 -FREEBUSY:20061223T030000/20061223T050000 +FREEBUSY:20061202T183000/20061202T203000 +FREEBUSY:20070102T183000/20070102T203000 +FREEBUSY:20070202T183000/20070202T203000 +FREEBUSY:20070302T183000/20070302T203000 +FREEBUSY:20070402T183000/20070402T203000 +FREEBUSY:20070502T183000/20070502T203000 +FREEBUSY:20070602T183000/20070602T203000 END:VFREEBUSY END:VCALENDAR diff --git a/testing/tests/regression-suite/835-freebusy.result b/testing/tests/regression-suite/835-freebusy.result index 4f1a8472..738251ed 100644 --- a/testing/tests/regression-suite/835-freebusy.result +++ b/testing/tests/regression-suite/835-freebusy.result @@ -11,6 +11,7 @@ DTSTAMP:yyyymmddThhmmssZ DTSTART:yyyymmddThhmmss DTEND:yyyymmddThhmmss FREEBUSY;FBTYPE=BUSY-TENTATIVE:20061223T060000/20061223T080000 +FREEBUSY:20061101T233000/20061102T003000 FREEBUSY:20061031T210000/20061031T220000 FREEBUSY:20061102T210000/20061102T220000 FREEBUSY:20061109T210000/20061109T220000 @@ -38,14 +39,7 @@ FREEBUSY:20070405T210000/20070405T220000 FREEBUSY:20070412T210000/20070412T220000 FREEBUSY:20070419T210000/20070419T220000 FREEBUSY:20070426T210000/20070426T220000 -FREEBUSY:20061101T233000/20061102T003000 -FREEBUSY:20061202T183000/20061202T203000 -FREEBUSY:20070102T183000/20070102T203000 -FREEBUSY:20070202T183000/20070202T203000 -FREEBUSY:20070302T183000/20070302T203000 -FREEBUSY:20070402T183000/20070402T203000 -FREEBUSY:20070502T183000/20070502T203000 -FREEBUSY:20070602T183000/20070602T203000 +FREEBUSY:20061223T030000/20061223T050000 FREEBUSY:20061117T030000/20061117T044500 FREEBUSY:20061201T030000/20061201T044500 FREEBUSY:20061215T030000/20061215T044500 @@ -63,6 +57,12 @@ FREEBUSY:20070518T030000/20070518T044500 FREEBUSY:20070601T030000/20070601T044500 FREEBUSY:20070615T030000/20070615T044500 FREEBUSY:20070629T030000/20070629T044500 -FREEBUSY:20061223T030000/20061223T050000 +FREEBUSY:20061202T183000/20061202T203000 +FREEBUSY:20070102T183000/20070102T203000 +FREEBUSY:20070202T183000/20070202T203000 +FREEBUSY:20070302T183000/20070302T203000 +FREEBUSY:20070402T183000/20070402T203000 +FREEBUSY:20070502T183000/20070502T203000 +FREEBUSY:20070602T183000/20070602T203000 END:VFREEBUSY END:VCALENDAR diff --git a/testing/tests/regression-suite/836-freebusy.result b/testing/tests/regression-suite/836-freebusy.result index 4f1a8472..738251ed 100644 --- a/testing/tests/regression-suite/836-freebusy.result +++ b/testing/tests/regression-suite/836-freebusy.result @@ -11,6 +11,7 @@ DTSTAMP:yyyymmddThhmmssZ DTSTART:yyyymmddThhmmss DTEND:yyyymmddThhmmss FREEBUSY;FBTYPE=BUSY-TENTATIVE:20061223T060000/20061223T080000 +FREEBUSY:20061101T233000/20061102T003000 FREEBUSY:20061031T210000/20061031T220000 FREEBUSY:20061102T210000/20061102T220000 FREEBUSY:20061109T210000/20061109T220000 @@ -38,14 +39,7 @@ FREEBUSY:20070405T210000/20070405T220000 FREEBUSY:20070412T210000/20070412T220000 FREEBUSY:20070419T210000/20070419T220000 FREEBUSY:20070426T210000/20070426T220000 -FREEBUSY:20061101T233000/20061102T003000 -FREEBUSY:20061202T183000/20061202T203000 -FREEBUSY:20070102T183000/20070102T203000 -FREEBUSY:20070202T183000/20070202T203000 -FREEBUSY:20070302T183000/20070302T203000 -FREEBUSY:20070402T183000/20070402T203000 -FREEBUSY:20070502T183000/20070502T203000 -FREEBUSY:20070602T183000/20070602T203000 +FREEBUSY:20061223T030000/20061223T050000 FREEBUSY:20061117T030000/20061117T044500 FREEBUSY:20061201T030000/20061201T044500 FREEBUSY:20061215T030000/20061215T044500 @@ -63,6 +57,12 @@ FREEBUSY:20070518T030000/20070518T044500 FREEBUSY:20070601T030000/20070601T044500 FREEBUSY:20070615T030000/20070615T044500 FREEBUSY:20070629T030000/20070629T044500 -FREEBUSY:20061223T030000/20061223T050000 +FREEBUSY:20061202T183000/20061202T203000 +FREEBUSY:20070102T183000/20070102T203000 +FREEBUSY:20070202T183000/20070202T203000 +FREEBUSY:20070302T183000/20070302T203000 +FREEBUSY:20070402T183000/20070402T203000 +FREEBUSY:20070502T183000/20070502T203000 +FREEBUSY:20070602T183000/20070602T203000 END:VFREEBUSY END:VCALENDAR From 59108071baa8d81dc1e95335c957e5d7f8b6697a Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 25 Jan 2008 07:59:45 +1300 Subject: [PATCH 31/65] Enforce permissions on multiget, which might conceivably be retrieving events from multiple calendars in one pass. --- inc/caldav-REPORT-multiget.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/inc/caldav-REPORT-multiget.php b/inc/caldav-REPORT-multiget.php index f0d0a292..516fda59 100644 --- a/inc/caldav-REPORT-multiget.php +++ b/inc/caldav-REPORT-multiget.php @@ -47,15 +47,14 @@ $where = " WHERE caldav_data.dav_name ~ ".qpg("^".$request->path)." "; if ( $href_in != "" ) { $where .= " AND caldav_data.dav_name IN ( $href_in ) "; } -if ( ! $request->AllowedTo('all') ) { - $where .= "AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL) "; -} +$where .= "AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL OR get_permissions($session->user_no,calendar_item.user_no) ~ 'A') "; if ( isset($c->hide_TODO) && $c->hide_TODO && ! $request->AllowedTo('all') ) { $where .= "AND caldav_data.caldav_type NOT IN ('VTODO') "; } -$qry = new PgQuery( "SELECT * FROM caldav_data INNER JOIN calendar_item USING(user_no, dav_name)". $where ); +$qry = new PgQuery( "SELECT * FROM caldav_data INNER JOIN calendar_item USING(dav_id, user_no, dav_name)". $where ); +if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY dav_id"; if ( $qry->Exec("REPORT",__LINE__,__FILE__) && $qry->rows > 0 ) { while( $calendar_object = $qry->Fetch() ) { $responses[] = calendar_to_xml( $properties, $calendar_object ); From 75ecf68b2018d0bb069cfed08799ad66c56186bd Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 25 Jan 2008 08:00:15 +1300 Subject: [PATCH 32/65] Ensure expanded 'A' is unexpanded in the end. --- dba/caldav_functions.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dba/caldav_functions.sql b/dba/caldav_functions.sql index e1f0d812..562582fb 100644 --- a/dba/caldav_functions.sql +++ b/dba/caldav_functions.sql @@ -271,6 +271,10 @@ BEGIN tmp_txt := tmp_txt || substring(tmp_confers,counter,1); END IF; END LOOP; + IF tmp_txt = ''FBRWU'' THEN + -- Shrink that mask back down + tmp_txt := ''A''; + END IF; RETURN dbg || tmp_txt; END IF; END IF; From 6e0b4f8e92e7aa62c46ed9dd211745f5e7dd8a1b Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 25 Jan 2008 08:06:33 +1300 Subject: [PATCH 33/65] Performance change applied to PROPFIND. --- inc/caldav-PROPFIND.php | 4 +- .../013-Mulberry-PROPFIND-5.result | 24 +- .../015-Mulberry-PROPFIND-6.result | 24 +- .../309-Chandler-PROPFIND-4.result | 124 ++++---- .../regression-suite/504-iCal-PROPFIND.result | 150 ++++----- .../regression-suite/602-Soho-PROPFIND.result | 152 ++++----- .../822-Spec-PROPFIND-3.result | 300 +++++++++--------- 7 files changed, 389 insertions(+), 389 deletions(-) diff --git a/inc/caldav-PROPFIND.php b/inc/caldav-PROPFIND.php index 65b3a807..72e4b808 100644 --- a/inc/caldav-PROPFIND.php +++ b/inc/caldav-PROPFIND.php @@ -616,9 +616,9 @@ function get_collection_contents( $depth, $user_no, $collection ) { $sql .= "to_char(coalesce(calendar_item.created, caldav_data.created) at time zone 'GMT',?) AS created, "; $sql .= "to_char(last_modified at time zone 'GMT',?) AS modified, "; $sql .= "summary AS dav_displayname "; - $sql .= "FROM caldav_data JOIN calendar_item USING( user_no, dav_name) "; + $sql .= "FROM caldav_data JOIN calendar_item USING( dav_id, user_no, dav_name) "; $sql .= "WHERE dav_name ~ ".qpg('^'.$collection->dav_name.'[^/]+$'). $privacy_clause; - $sql .= "ORDER BY caldav_data.dav_name "; + if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $sql .= " ORDER BY dav_id"; $qry = new PgQuery($sql, PgQuery::Plain(iCalendar::HttpDateFormat()), PgQuery::Plain(iCalendar::HttpDateFormat())); if( $qry->Exec("PROPFIND",__LINE__,__FILE__) && $qry->rows > 0 ) { while( $item = $qry->Fetch() ) { diff --git a/testing/tests/regression-suite/013-Mulberry-PROPFIND-5.result b/testing/tests/regression-suite/013-Mulberry-PROPFIND-5.result index a3dd940f..bd02dd6c 100644 --- a/testing/tests/regression-suite/013-Mulberry-PROPFIND-5.result +++ b/testing/tests/regression-suite/013-Mulberry-PROPFIND-5.result @@ -1,7 +1,7 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "4cd4df7d08592927b92bcd697c2cdde7" +ETag: "b47e970cba800e5f7f16afd3121d374e" Content-Length: 1055 Content-Type: text/xml; charset="utf-8" @@ -21,17 +21,6 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK - - /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics - - - 705 - text/calendar - - - HTTP/1.1 200 OK - - /caldav.php/user1/home/F56B49B10FC923D20FE2DC92D6580340-0.ics @@ -43,4 +32,15 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK + + /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics + + + 705 + text/calendar + + + HTTP/1.1 200 OK + + diff --git a/testing/tests/regression-suite/015-Mulberry-PROPFIND-6.result b/testing/tests/regression-suite/015-Mulberry-PROPFIND-6.result index 44ab7700..ce8cc1de 100644 --- a/testing/tests/regression-suite/015-Mulberry-PROPFIND-6.result +++ b/testing/tests/regression-suite/015-Mulberry-PROPFIND-6.result @@ -1,7 +1,7 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "d880baf3102a9de9bcea4d5f71a6b500" +ETag: "e8fc600073377430c336d98d898d38cf" Content-Length: 1055 Content-Type: text/xml; charset="utf-8" @@ -21,17 +21,6 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK - - /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics - - - 747 - text/calendar - - - HTTP/1.1 200 OK - - /caldav.php/user1/home/F56B49B10FC923D20FE2DC92D6580340-0.ics @@ -43,4 +32,15 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK + + /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics + + + 747 + text/calendar + + + HTTP/1.1 200 OK + + diff --git a/testing/tests/regression-suite/309-Chandler-PROPFIND-4.result b/testing/tests/regression-suite/309-Chandler-PROPFIND-4.result index 4cfe0a50..3d548c66 100644 --- a/testing/tests/regression-suite/309-Chandler-PROPFIND-4.result +++ b/testing/tests/regression-suite/309-Chandler-PROPFIND-4.result @@ -1,7 +1,7 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "307a9592c8e442356bbeb566b87f3de1" +ETag: "bce9e0e26a74b6340ceb6385f008c3f7" Content-Length: 4233 Content-Type: text/xml; charset="utf-8" @@ -22,23 +22,12 @@ Content-Type: text/xml; charset="utf-8" - /caldav.php/user1/home/0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics + /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics - Due 7/8/7 16:30, completed - "00ad5eb1eb5507884710b0b66aa5d5c4" - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/1906b3ca-4890-468a-9b58-1de74bf2c716.ics - - - - Private Event - "5def8ae2b20893a1c7f4dbaeb008f2f1" + Lunch with David + "2c32a2f8aba853654eb17fe037a4db4d" HTTP/1.1 200 OK @@ -54,28 +43,6 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK - - /caldav.php/user1/home/2178279a-aec2-471f-832d-1f6df6203f2f.ics - - - - Incomplete, uncancelled - "509b0f0d8a3363379f9f5727f5dd74a0" - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics - - - - Lunch with David - "2c32a2f8aba853654eb17fe037a4db4d" - - HTTP/1.1 200 OK - - /caldav.php/user1/home/4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics @@ -87,17 +54,6 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK - - /caldav.php/user1/home/917b9e47-b748-4550-a566-657fbe672447.ics - - - - 50% Complete, uncancelled - "cb3d9dc3e8c157f53eba3ea0e1e0f146" - - HTTP/1.1 200 OK - - /caldav.php/user1/home/9d050be7-8a02-4355-8ed3-02a9fc5f473f.ics @@ -109,6 +65,61 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK + + /caldav.php/user1/home/1906b3ca-4890-468a-9b58-1de74bf2c716.ics + + + + Private Event + "5def8ae2b20893a1c7f4dbaeb008f2f1" + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics + + + + Tentative Event + "ac90acd649c25070b1a2a17fb31a105a" + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/2178279a-aec2-471f-832d-1f6df6203f2f.ics + + + + Incomplete, uncancelled + "509b0f0d8a3363379f9f5727f5dd74a0" + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/917b9e47-b748-4550-a566-657fbe672447.ics + + + + 50% Complete, uncancelled + "cb3d9dc3e8c157f53eba3ea0e1e0f146" + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics + + + + Due 7/8/7 16:30, completed + "00ad5eb1eb5507884710b0b66aa5d5c4" + + HTTP/1.1 200 OK + + /caldav.php/user1/home/b1679f77-673d-4f46-b3eb-2420e1bba301.ics @@ -120,17 +131,6 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK - - /caldav.php/user1/home/e6eb5bc9-f7f9-4a0a-94e8-8e90eefc7d08.ics - - - - Release 0.9.3 - "8f581a053df6d833254756dfd7553d37" - - HTTP/1.1 200 OK - - /caldav.php/user1/home/e70576e9-c1e0-431e-a507-0386fd82f223.ics @@ -143,12 +143,12 @@ Content-Type: text/xml; charset="utf-8" - /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics + /caldav.php/user1/home/e6eb5bc9-f7f9-4a0a-94e8-8e90eefc7d08.ics - Tentative Event - "ac90acd649c25070b1a2a17fb31a105a" + Release 0.9.3 + "8f581a053df6d833254756dfd7553d37" HTTP/1.1 200 OK diff --git a/testing/tests/regression-suite/504-iCal-PROPFIND.result b/testing/tests/regression-suite/504-iCal-PROPFIND.result index 9da477a3..0a0bdab6 100644 --- a/testing/tests/regression-suite/504-iCal-PROPFIND.result +++ b/testing/tests/regression-suite/504-iCal-PROPFIND.result @@ -1,7 +1,7 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "c6c4b54709e3dac67c5c7dd1d8bf30ea" +ETag: "e41d8d104775e6a9825b87875b071159" Content-Length: 4107 Content-Type: text/xml; charset="utf-8" @@ -21,21 +21,11 @@ Content-Type: text/xml; charset="utf-8" - /caldav.php/user1/home/0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics + /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics - "00ad5eb1eb5507884710b0b66aa5d5c4" - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/1906b3ca-4890-468a-9b58-1de74bf2c716.ics - - - - "5def8ae2b20893a1c7f4dbaeb008f2f1" + "2c32a2f8aba853654eb17fe037a4db4d" HTTP/1.1 200 OK @@ -50,26 +40,6 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK - - /caldav.php/user1/home/2178279a-aec2-471f-832d-1f6df6203f2f.ics - - - - "509b0f0d8a3363379f9f5727f5dd74a0" - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics - - - - "2c32a2f8aba853654eb17fe037a4db4d" - - HTTP/1.1 200 OK - - /caldav.php/user1/home/4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics @@ -80,26 +50,6 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK - - /caldav.php/user1/home/71e2ae82-7870-11db-c6d6-f6927c144649.ics - - - - "0d7a68984bf525342d22b8924a57e8e2" - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/917b9e47-b748-4550-a566-657fbe672447.ics - - - - "cb3d9dc3e8c157f53eba3ea0e1e0f146" - - HTTP/1.1 200 OK - - /caldav.php/user1/home/9d050be7-8a02-4355-8ed3-02a9fc5f473f.ics @@ -110,6 +60,56 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK + + /caldav.php/user1/home/1906b3ca-4890-468a-9b58-1de74bf2c716.ics + + + + "5def8ae2b20893a1c7f4dbaeb008f2f1" + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics + + + + "ac90acd649c25070b1a2a17fb31a105a" + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/2178279a-aec2-471f-832d-1f6df6203f2f.ics + + + + "509b0f0d8a3363379f9f5727f5dd74a0" + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/917b9e47-b748-4550-a566-657fbe672447.ics + + + + "cb3d9dc3e8c157f53eba3ea0e1e0f146" + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics + + + + "00ad5eb1eb5507884710b0b66aa5d5c4" + + HTTP/1.1 200 OK + + /caldav.php/user1/home/b1679f77-673d-4f46-b3eb-2420e1bba301.ics @@ -120,26 +120,6 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK - - /caldav.php/user1/home/da81c0ee-7871-11db-c6d6-f6927c144649.ics - - - - "421abf7e4848d2fecbf64217ed205d4b" - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/e6eb5bc9-f7f9-4a0a-94e8-8e90eefc7d08.ics - - - - "8f581a053df6d833254756dfd7553d37" - - HTTP/1.1 200 OK - - /caldav.php/user1/home/e70576e9-c1e0-431e-a507-0386fd82f223.ics @@ -151,11 +131,31 @@ Content-Type: text/xml; charset="utf-8" - /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics + /caldav.php/user1/home/e6eb5bc9-f7f9-4a0a-94e8-8e90eefc7d08.ics - "ac90acd649c25070b1a2a17fb31a105a" + "8f581a053df6d833254756dfd7553d37" + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/71e2ae82-7870-11db-c6d6-f6927c144649.ics + + + + "0d7a68984bf525342d22b8924a57e8e2" + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/da81c0ee-7871-11db-c6d6-f6927c144649.ics + + + + "421abf7e4848d2fecbf64217ed205d4b" HTTP/1.1 200 OK diff --git a/testing/tests/regression-suite/602-Soho-PROPFIND.result b/testing/tests/regression-suite/602-Soho-PROPFIND.result index 05ed9f72..ea1180eb 100644 --- a/testing/tests/regression-suite/602-Soho-PROPFIND.result +++ b/testing/tests/regression-suite/602-Soho-PROPFIND.result @@ -1,7 +1,7 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "9cd5b2172bdaa7cc59b004100c6fea86" +ETag: "389ac8095128eacc4fd28339b0741d4d" Transfer-Encoding: chunked Content-Type: text/xml; charset="utf-8" @@ -50,21 +50,7 @@ Content-Type: text/xml; charset="utf-8" - /caldav.php/user1/home/0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics - - - - /caldav.php/user1/ - - - /caldav.php/user1/ - - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/1906b3ca-4890-468a-9b58-1de74bf2c716.ics + /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics @@ -91,34 +77,6 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK - - /caldav.php/user1/home/2178279a-aec2-471f-832d-1f6df6203f2f.ics - - - - /caldav.php/user1/ - - - /caldav.php/user1/ - - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics - - - - /caldav.php/user1/ - - - /caldav.php/user1/ - - - HTTP/1.1 200 OK - - /caldav.php/user1/home/4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics @@ -133,34 +91,6 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK - - /caldav.php/user1/home/71e2ae82-7870-11db-c6d6-f6927c144649.ics - - - - /caldav.php/user1/ - - - /caldav.php/user1/ - - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/917b9e47-b748-4550-a566-657fbe672447.ics - - - - /caldav.php/user1/ - - - /caldav.php/user1/ - - - HTTP/1.1 200 OK - - /caldav.php/user1/home/9d050be7-8a02-4355-8ed3-02a9fc5f473f.ics @@ -176,7 +106,63 @@ Content-Type: text/xml; charset="utf-8" - /caldav.php/user1/home/AAA9318E-37D9-4319-8626-95ECD3D3B243.ics + /caldav.php/user1/home/1906b3ca-4890-468a-9b58-1de74bf2c716.ics + + + + /caldav.php/user1/ + + + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics + + + + /caldav.php/user1/ + + + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/2178279a-aec2-471f-832d-1f6df6203f2f.ics + + + + /caldav.php/user1/ + + + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/917b9e47-b748-4550-a566-657fbe672447.ics + + + + /caldav.php/user1/ + + + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics @@ -204,7 +190,7 @@ Content-Type: text/xml; charset="utf-8" - /caldav.php/user1/home/da81c0ee-7871-11db-c6d6-f6927c144649.ics + /caldav.php/user1/home/e70576e9-c1e0-431e-a507-0386fd82f223.ics @@ -232,7 +218,7 @@ Content-Type: text/xml; charset="utf-8" - /caldav.php/user1/home/e70576e9-c1e0-431e-a507-0386fd82f223.ics + /caldav.php/user1/home/71e2ae82-7870-11db-c6d6-f6927c144649.ics @@ -246,7 +232,21 @@ Content-Type: text/xml; charset="utf-8" - /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics + /caldav.php/user1/home/da81c0ee-7871-11db-c6d6-f6927c144649.ics + + + + /caldav.php/user1/ + + + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/AAA9318E-37D9-4319-8626-95ECD3D3B243.ics diff --git a/testing/tests/regression-suite/822-Spec-PROPFIND-3.result b/testing/tests/regression-suite/822-Spec-PROPFIND-3.result index cbe7811e..f38af346 100644 --- a/testing/tests/regression-suite/822-Spec-PROPFIND-3.result +++ b/testing/tests/regression-suite/822-Spec-PROPFIND-3.result @@ -39,42 +39,16 @@ - /caldav.php/user1/home/0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics + /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics Dow, 01 Jan 2000 00:00:00 GMT - 961 + 747 text/calendar Dow, 01 Jan 2000 00:00:00 GMT - Due 7/8/7 16:30, completed - "00ad5eb1eb5507884710b0b66aa5d5c4" - en_NZ.UTF-8 - - - - - - - - - - - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/1906b3ca-4890-468a-9b58-1de74bf2c716.ics - - - Dow, 01 Jan 2000 00:00:00 GMT - 970 - text/calendar - Dow, 01 Jan 2000 00:00:00 GMT - - Private Event - "5def8ae2b20893a1c7f4dbaeb008f2f1" + Lunch with David + "2c32a2f8aba853654eb17fe037a4db4d" en_NZ.UTF-8 @@ -116,58 +90,6 @@ HTTP/1.1 200 OK - - /caldav.php/user1/home/2178279a-aec2-471f-832d-1f6df6203f2f.ics - - - Dow, 01 Jan 2000 00:00:00 GMT - 415 - text/calendar - Dow, 01 Jan 2000 00:00:00 GMT - - Incomplete, uncancelled - "509b0f0d8a3363379f9f5727f5dd74a0" - en_NZ.UTF-8 - - - - - - - - - - - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics - - - Dow, 01 Jan 2000 00:00:00 GMT - 747 - text/calendar - Dow, 01 Jan 2000 00:00:00 GMT - - Lunch with David - "2c32a2f8aba853654eb17fe037a4db4d" - en_NZ.UTF-8 - - - - - - - - - - - - HTTP/1.1 200 OK - - /caldav.php/user1/home/4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics @@ -194,58 +116,6 @@ HTTP/1.1 200 OK - - /caldav.php/user1/home/71e2ae82-7870-11db-c6d6-f6927c144649.ics - - - Dow, 01 Jan 2000 00:00:00 GMT - 743 - text/calendar - Dow, 01 Jan 2000 00:00:00 GMT - - Beer O'Clock - "0d7a68984bf525342d22b8924a57e8e2" - en_NZ.UTF-8 - - - - - - - - - - - - HTTP/1.1 200 OK - - - - /caldav.php/user1/home/917b9e47-b748-4550-a566-657fbe672447.ics - - - Dow, 01 Jan 2000 00:00:00 GMT - 449 - text/calendar - Dow, 01 Jan 2000 00:00:00 GMT - - 50% Complete, uncancelled - "cb3d9dc3e8c157f53eba3ea0e1e0f146" - en_NZ.UTF-8 - - - - - - - - - - - - HTTP/1.1 200 OK - - /caldav.php/user1/home/9d050be7-8a02-4355-8ed3-02a9fc5f473f.ics @@ -273,16 +143,120 @@ - /caldav.php/user1/home/AAA9318E-37D9-4319-8626-95ECD3D3B243.ics + /caldav.php/user1/home/1906b3ca-4890-468a-9b58-1de74bf2c716.ics Dow, 01 Jan 2000 00:00:00 GMT - 981 + 970 text/calendar Dow, 01 Jan 2000 00:00:00 GMT - BBQ @ ML's - "5f050eca5480bbebbe9428222570913d" + Private Event + "5def8ae2b20893a1c7f4dbaeb008f2f1" + en_NZ.UTF-8 + + + + + + + + + + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics + + + Dow, 01 Jan 2000 00:00:00 GMT + 929 + text/calendar + Dow, 01 Jan 2000 00:00:00 GMT + + Tentative Event + "ac90acd649c25070b1a2a17fb31a105a" + en_NZ.UTF-8 + + + + + + + + + + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/2178279a-aec2-471f-832d-1f6df6203f2f.ics + + + Dow, 01 Jan 2000 00:00:00 GMT + 415 + text/calendar + Dow, 01 Jan 2000 00:00:00 GMT + + Incomplete, uncancelled + "509b0f0d8a3363379f9f5727f5dd74a0" + en_NZ.UTF-8 + + + + + + + + + + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/917b9e47-b748-4550-a566-657fbe672447.ics + + + Dow, 01 Jan 2000 00:00:00 GMT + 449 + text/calendar + Dow, 01 Jan 2000 00:00:00 GMT + + 50% Complete, uncancelled + "cb3d9dc3e8c157f53eba3ea0e1e0f146" + en_NZ.UTF-8 + + + + + + + + + + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics + + + Dow, 01 Jan 2000 00:00:00 GMT + 961 + text/calendar + Dow, 01 Jan 2000 00:00:00 GMT + + Due 7/8/7 16:30, completed + "00ad5eb1eb5507884710b0b66aa5d5c4" en_NZ.UTF-8 @@ -325,16 +299,16 @@ - /caldav.php/user1/home/da81c0ee-7871-11db-c6d6-f6927c144649.ics + /caldav.php/user1/home/e70576e9-c1e0-431e-a507-0386fd82f223.ics Dow, 01 Jan 2000 00:00:00 GMT - 302 + 1119 text/calendar Dow, 01 Jan 2000 00:00:00 GMT - Morning Mgmt Mtg - "421abf7e4848d2fecbf64217ed205d4b" + Morning Meeting + "e8060931f30c1798ac58ffbe4ec0bffc" en_NZ.UTF-8 @@ -377,16 +351,16 @@ - /caldav.php/user1/home/e70576e9-c1e0-431e-a507-0386fd82f223.ics + /caldav.php/user1/home/71e2ae82-7870-11db-c6d6-f6927c144649.ics Dow, 01 Jan 2000 00:00:00 GMT - 1119 + 743 text/calendar Dow, 01 Jan 2000 00:00:00 GMT - Morning Meeting - "e8060931f30c1798ac58ffbe4ec0bffc" + Beer O'Clock + "0d7a68984bf525342d22b8924a57e8e2" en_NZ.UTF-8 @@ -403,16 +377,42 @@ - /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics + /caldav.php/user1/home/da81c0ee-7871-11db-c6d6-f6927c144649.ics Dow, 01 Jan 2000 00:00:00 GMT - 929 + 302 text/calendar Dow, 01 Jan 2000 00:00:00 GMT - Tentative Event - "ac90acd649c25070b1a2a17fb31a105a" + Morning Mgmt Mtg + "421abf7e4848d2fecbf64217ed205d4b" + en_NZ.UTF-8 + + + + + + + + + + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/AAA9318E-37D9-4319-8626-95ECD3D3B243.ics + + + Dow, 01 Jan 2000 00:00:00 GMT + 981 + text/calendar + Dow, 01 Jan 2000 00:00:00 GMT + + BBQ @ ML's + "5f050eca5480bbebbe9428222570913d" en_NZ.UTF-8 From 7472f88bc5a2ea9551d2df08bcfb2b2625fddc9c Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 25 Jan 2008 22:09:03 +1300 Subject: [PATCH 34/65] Fix parsing of incoming VCALENDAR to correctly preserve timezone info. --- inc/caldav-PUT-functions.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/inc/caldav-PUT-functions.php b/inc/caldav-PUT-functions.php index 28e856fe..17c17def 100644 --- a/inc/caldav-PUT-functions.php +++ b/inc/caldav-PUT-functions.php @@ -141,36 +141,41 @@ function import_collection( $ics_content, $user_no, $path, $caldav_context ) { $state = ""; $tzid = 'unknown'; foreach( $lines AS $lno => $line ) { - dbg_error_log( "PUT", "CalendarLine[%04d] - %s: %s", $lno, $state, $line ); if ( $state == "" ) { - if ( preg_match( '/^BEGIN:(VEVENT|VTIMEZONE|VTODO)$/', $line, $matches ) ) { + if ( preg_match( '/^BEGIN:(VEVENT|VTIMEZONE|VTODO|VJOURNAL)$/', $line, $matches ) ) { $current .= $line."\n"; $state = $matches[1]; + dbg_error_log( "PUT", "CalendarLine[%04d] - %s: %s", $lno, $state, $line ); } } else { $current .= $line."\n"; if ( $line == "END:$state" ) { switch ( $state ) { - case 'VEVENT': - $events[] = array( 'data' => $current, 'tzid' => $tzid ); - break; - case 'VTODO': - $events[] = array( 'data' => $current, 'tzid' => $tzid ); - break; case 'VTIMEZONE': $timezones[$tzid] = $current; + dbg_error_log( "PUT", " Ended VTIMEZONE for TZID '%s' ", $tzid ); + break; + case 'VEVENT': + case 'VTODO': + case 'VJOURNAL': + default: + $events[] = array( 'data' => $current, 'tzid' => $tzid ); + dbg_error_log( "PUT", " Ended %s with TZID '%s' ", $state, $tzid ); break; } $state = ""; $current = ""; $tzid = 'unknown'; } - else if ( preg_match( '/TZID=([^:]+)(:|$)/', $line, $matches ) ) { + else if ( preg_match( '/TZID[:=]([^:]+)(:|$)/', $line, $matches ) ) { $tzid = $matches[1]; + dbg_error_log( "PUT", " Found TZID of '%s' in '%s'", $tzid, $line ); } } } + dbg_error_log( "PUT", " Finished input after $lno lines" ); + $qry = new PgQuery("BEGIN; DELETE FROM calendar_item WHERE user_no=? AND dav_name ~ ?; DELETE FROM caldav_data WHERE user_no=? AND dav_name ~ ?;", $user_no, $path.'[^/]+$', $user_no, $path.'[^/]+$'); if ( !$qry->Exec("PUT") ) rollback_on_error( $caldav_context, $user_no, $path ); From 3cd8fe464b58459cc38c493cb3d748d09c676d8f Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 25 Jan 2008 22:10:01 +1300 Subject: [PATCH 35/65] Performance improvement. --- inc/caldav-GET.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/caldav-GET.php b/inc/caldav-GET.php index a65fa9b5..7b21f8a3 100644 --- a/inc/caldav-GET.php +++ b/inc/caldav-GET.php @@ -23,10 +23,11 @@ if ( $request->IsCollection() ) { * The CalDAV specification does not define GET on a collection, but typically this is * used as a .ics download for the whole collection, which is what we do also. */ - $qry = new PgQuery( "SELECT caldav_data, class, caldav_type, calendar_item.user_no FROM caldav_data LEFT JOIN calendar_item USING ( dav_name ) WHERE caldav_data.user_no = ? AND caldav_data.dav_name ~ ? $privacy_clause ORDER BY caldav_data.user_no, caldav_data.dav_name, caldav_data.created;", $request->user_no, $request->path.'[^/]+$'); + $order_clause = ( isset($c->strict_result_ordering) && $c->strict_result_ordering ? " ORDER BY dav_id" : ""); + $qry = new PgQuery( "SELECT caldav_data, class, caldav_type, calendar_item.user_no FROM caldav_data INNER JOIN calendar_item USING ( dav_id ) WHERE caldav_data.user_no = ? AND caldav_data.dav_name ~ ? $privacy_clause $order_clause", $request->user_no, $request->path.'[^/]+$'); } else { - $qry = new PgQuery( "SELECT caldav_data, caldav_data.dav_etag, class, caldav_type, calendar_item.user_no FROM caldav_data LEFT JOIN calendar_item USING ( dav_name ) WHERE caldav_data.user_no = ? AND caldav_data.dav_name = ? $privacy_clause;", $request->user_no, $request->path); + $qry = new PgQuery( "SELECT caldav_data, caldav_data.dav_etag, class, caldav_type, calendar_item.user_no FROM caldav_data INNER JOIN calendar_item USING ( dav_id ) WHERE caldav_data.user_no = ? AND caldav_data.dav_name = ? $privacy_clause;", $request->user_no, $request->path); } dbg_error_log("get", "%s", $qry->querystring ); if ( $qry->Exec("GET") && $qry->rows == 1 ) { From 8a3ff610b46e7a4aa03273225de0720522fa8825 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 00:21:12 +1300 Subject: [PATCH 36/65] Changes due to GET/PUT collection reordering and timezone fix. --- .../901-GET-Collection.result | 242 +++++------ .../regression-suite/902-PUT-collection.test | 42 ++ .../903-GET-Collection.result | 384 +++++++++--------- 3 files changed, 355 insertions(+), 313 deletions(-) diff --git a/testing/tests/regression-suite/901-GET-Collection.result b/testing/tests/regression-suite/901-GET-Collection.result index eec78c33..f950b4f2 100644 --- a/testing/tests/regression-suite/901-GET-Collection.result +++ b/testing/tests/regression-suite/901-GET-Collection.result @@ -8,34 +8,14 @@ BEGIN:VCALENDAR PRODID:-//Catalyst.Net.NZ//NONSGML AWL Calendar//EN VERSION:2.0 X-WR-CALNAME:User One's Calendar -BEGIN:VTODO -CREATED:20070805T201647Z -LAST-MODIFIED:20070805T201834Z -DTSTAMP:20070805T201647Z -UID:0575d895-a006-4ed8-9be6-0d1b6b6b1f96 -SUMMARY:Due 7/8/7 16:30\, completed -STATUS:COMPLETED -DUE;TZID=/mozilla.org/20070129_1/Antarctica/McMurdo:20070807T163000 -COMPLETED:20070805T201737Z -PERCENT-COMPLETE:100 -X-MOZ-LOCATIONPATH:0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics -DESCRIPTION:Due on 7/8/7 at 4:30pm\, but completed alread on 6/8/7 -CATEGORIES:Projects -END:VTODO BEGIN:VEVENT -CREATED:20061223T031415Z -LAST-MODIFIED:20061223T032305Z -DTSTAMP:20061223T032305Z -UID:1906b3ca-4890-468a-9b58-1de74bf2c716 -SUMMARY:Private Event -PRIORITY:0 -STATUS:CONFIRMED -CLASS:PRIVATE -DTSTART;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061223T130000 -DTEND;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061223T150000 -X-MOZ-LOCATIONPATH:1906b3ca-4890-468a-9b58-1de74bf2c716.ics -LOCATION:At a private location -DESCRIPTION:Private and Confirmed +DTSTAMP:20061102T090217Z +DTSTART;TZID=New Zealand Standard Time:20061102T123000 +DURATION:PT1H +LAST-MODIFIED:20061104T002921Z +SEQUENCE:1 +SUMMARY:Lunch with David +UID:5A55230C8866CA8D3D325F3A@CA1CBED546AAE36FF3BC722E END:VEVENT BEGIN:VEVENT UID:20061101T073000Z-10468-1000-1-7@ubu @@ -51,25 +31,6 @@ TRIGGER;VALUE=DURATION;RELATED=START:-PT15M DESCRIPTION:A Meeting END:VALARM END:VEVENT -BEGIN:VTODO -CREATED:20070805T200215Z -LAST-MODIFIED:20070805T201531Z -DTSTAMP:20070805T200215Z -UID:2178279a-aec2-471f-832d-1f6df6203f2f -SUMMARY:Incomplete\, uncancelled -X-MOZ-LOCATIONPATH:2178279a-aec2-471f-832d-1f6df6203f2f.ics -DESCRIPTION:This task is incomplete and has not been cancelled (has no - status at all) -END:VTODO -BEGIN:VEVENT -DTSTAMP:20061102T090217Z -DTSTART;TZID=New Zealand Standard Time:20061102T123000 -DURATION:PT1H -LAST-MODIFIED:20061104T002921Z -SEQUENCE:1 -SUMMARY:Lunch with David -UID:5A55230C8866CA8D3D325F3A@CA1CBED546AAE36FF3BC722E -END:VEVENT BEGIN:VEVENT CREATED:20061120T041336Z LAST-MODIFIED:20061120T041709Z @@ -85,28 +46,6 @@ CATEGORIES:Projects X-MOZ-LOCATIONPATH:4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics END:VEVENT BEGIN:VEVENT -UID:71e2ae82-7870-11db-c6d6-f6927c144649 -DTSTART;TZID=Pacific/Auckland:20061103T160000 -DTEND;TZID=Pacific/Auckland:20061103T174500 -DESCRIPTION: -LOCATION:Level 3 -RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=20071222T235900 -STATUS:CONFIRMED -SUMMARY:Beer O'Clock -END:VEVENT -BEGIN:VTODO -CREATED:20070805T201557Z -LAST-MODIFIED:20070805T201643Z -DTSTAMP:20070805T201557Z -UID:917b9e47-b748-4550-a566-657fbe672447 -SUMMARY:50% Complete\, uncancelled -STATUS:IN-PROCESS -PERCENT-COMPLETE:50 -X-MOZ-LOCATIONPATH:917b9e47-b748-4550-a566-657fbe672447.ics -DESCRIPTION:This task is in progress (50% complete) and has not been - cancelled. -END:VTODO -BEGIN:VEVENT CREATED:20061223T032350Z LAST-MODIFIED:20061223T033144Z DTSTAMP:20061223T033144Z @@ -121,22 +60,69 @@ X-MOZ-LOCATIONPATH:9d050be7-8a02-4355-8ed3-02a9fc5f473f.ics LOCATION:In a confidential place END:VEVENT BEGIN:VEVENT -SEQUENCE:6 -TRANSP:OPAQUE -UID:AAA9318E-37D9-4319-8626-95ECD3D3B243 -DTSTART;TZID=Pacific/Auckland:20071125T130000 -DTSTAMP:20071123T093223Z -SUMMARY:BBQ @ ML's -CREATED:20071123T093048Z -DTEND;TZID=Pacific/Auckland:20071125T190000 -LOCATION:ML's House -BEGIN:VALARM -X-WR-ALARMUID:2927836F-DF85-4688-901A-9ABE442BFB62 -ACTION:AUDIO -TRIGGER:-PT15M -ATTACH;VALUE=URI:Basso -END:VALARM +CREATED:20061223T031415Z +LAST-MODIFIED:20061223T032305Z +DTSTAMP:20061223T032305Z +UID:1906b3ca-4890-468a-9b58-1de74bf2c716 +SUMMARY:Private Event +PRIORITY:0 +STATUS:CONFIRMED +CLASS:PRIVATE +DTSTART;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061223T130000 +DTEND;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061223T150000 +X-MOZ-LOCATIONPATH:1906b3ca-4890-468a-9b58-1de74bf2c716.ics +LOCATION:At a private location +DESCRIPTION:Private and Confirmed END:VEVENT +BEGIN:VEVENT +CREATED:20061223T051646Z +LAST-MODIFIED:20061223T051713Z +DTSTAMP:20061223T051713Z +UID:fbd57454-d966-4a14-8341-abe1edb1ae66 +SUMMARY:Tentative Event +STATUS:TENTATIVE +CLASS:PUBLIC +DTSTART;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T190000 +DTEND;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T210000 +X-MOZ-LOCATIONPATH:fbd57454-d966-4a14-8341-abe1edb1ae66.ics +LOCATION:Never never land +END:VEVENT +BEGIN:VTODO +CREATED:20070805T200215Z +LAST-MODIFIED:20070805T201531Z +DTSTAMP:20070805T200215Z +UID:2178279a-aec2-471f-832d-1f6df6203f2f +SUMMARY:Incomplete\, uncancelled +X-MOZ-LOCATIONPATH:2178279a-aec2-471f-832d-1f6df6203f2f.ics +DESCRIPTION:This task is incomplete and has not been cancelled (has no + status at all) +END:VTODO +BEGIN:VTODO +CREATED:20070805T201557Z +LAST-MODIFIED:20070805T201643Z +DTSTAMP:20070805T201557Z +UID:917b9e47-b748-4550-a566-657fbe672447 +SUMMARY:50% Complete\, uncancelled +STATUS:IN-PROCESS +PERCENT-COMPLETE:50 +X-MOZ-LOCATIONPATH:917b9e47-b748-4550-a566-657fbe672447.ics +DESCRIPTION:This task is in progress (50% complete) and has not been + cancelled. +END:VTODO +BEGIN:VTODO +CREATED:20070805T201647Z +LAST-MODIFIED:20070805T201834Z +DTSTAMP:20070805T201647Z +UID:0575d895-a006-4ed8-9be6-0d1b6b6b1f96 +SUMMARY:Due 7/8/7 16:30\, completed +STATUS:COMPLETED +DUE;TZID=/mozilla.org/20070129_1/Antarctica/McMurdo:20070807T163000 +COMPLETED:20070805T201737Z +PERCENT-COMPLETE:100 +X-MOZ-LOCATIONPATH:0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics +DESCRIPTION:Due on 7/8/7 at 4:30pm\, but completed alread on 6/8/7 +CATEGORIES:Projects +END:VTODO BEGIN:VTODO CREATED:20070806T223244Z LAST-MODIFIED:20070806T223411Z @@ -151,33 +137,6 @@ DESCRIPTION:This is a task with a Start and a Due date\, but it has been cancelled. END:VTODO BEGIN:VEVENT -UID:da81c0ee-7871-11db-c6d6-f6927c144649 -DTSTART:20061103T073000 -DTEND:20061103T093000 -DESCRIPTION: -LOCATION:Olivia's -RRULE:FREQ=MONTHLY -STATUS:CONFIRMED -SUMMARY:Morning Mgmt Mtg -END:VEVENT -BEGIN:VTODO -CREATED:20071203T202915Z -LAST-MODIFIED:20071203T203021Z -DTSTAMP:20071203T202915Z -UID:e6eb5bc9-f7f9-4a0a-94e8-8e90eefc7d08 -SUMMARY:Release 0.9.3 -STATUS:IN-PROCESS -DTSTART;TZID=/mozilla.org/20070129_1/Antarctica/McMurdo:20071209T133000 -DUE;TZID=/mozilla.org/20070129_1/Antarctica/McMurdo:20071209T133000 -PERCENT-COMPLETE:95 -X-MOZ-LOCATIONPATH:e6eb5bc9-f7f9-4a0a-94e8-8e90eefc7d08.ics -BEGIN:VALARM -TRIGGER;VALUE=DURATION:-P2D -DESCRIPTION:Mozilla Alarm: Release 0.9.3 -ACTION:DISPLAY -END:VALARM -END:VTODO -BEGIN:VEVENT CREATED:20071203T202630Z LAST-MODIFIED:20071203T202834Z DTSTAMP:20071203T202630Z @@ -196,18 +155,59 @@ DESCRIPTION:Mozilla Alarm: Morning Meeting ACTION:DISPLAY END:VALARM END:VEVENT +BEGIN:VTODO +CREATED:20071203T202915Z +LAST-MODIFIED:20071203T203021Z +DTSTAMP:20071203T202915Z +UID:e6eb5bc9-f7f9-4a0a-94e8-8e90eefc7d08 +SUMMARY:Release 0.9.3 +STATUS:IN-PROCESS +DTSTART;TZID=/mozilla.org/20070129_1/Antarctica/McMurdo:20071209T133000 +DUE;TZID=/mozilla.org/20070129_1/Antarctica/McMurdo:20071209T133000 +PERCENT-COMPLETE:95 +X-MOZ-LOCATIONPATH:e6eb5bc9-f7f9-4a0a-94e8-8e90eefc7d08.ics +BEGIN:VALARM +TRIGGER;VALUE=DURATION:-P2D +DESCRIPTION:Mozilla Alarm: Release 0.9.3 +ACTION:DISPLAY +END:VALARM +END:VTODO BEGIN:VEVENT -CREATED:20061223T051646Z -LAST-MODIFIED:20061223T051713Z -DTSTAMP:20061223T051713Z -UID:fbd57454-d966-4a14-8341-abe1edb1ae66 -SUMMARY:Tentative Event -STATUS:TENTATIVE -CLASS:PUBLIC -DTSTART;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T190000 -DTEND;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T210000 -X-MOZ-LOCATIONPATH:fbd57454-d966-4a14-8341-abe1edb1ae66.ics -LOCATION:Never never land +UID:71e2ae82-7870-11db-c6d6-f6927c144649 +DTSTART;TZID=Pacific/Auckland:20061103T160000 +DTEND;TZID=Pacific/Auckland:20061103T174500 +DESCRIPTION: +LOCATION:Level 3 +RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=20071222T235900 +STATUS:CONFIRMED +SUMMARY:Beer O'Clock +END:VEVENT +BEGIN:VEVENT +UID:da81c0ee-7871-11db-c6d6-f6927c144649 +DTSTART:20061103T073000 +DTEND:20061103T093000 +DESCRIPTION: +LOCATION:Olivia's +RRULE:FREQ=MONTHLY +STATUS:CONFIRMED +SUMMARY:Morning Mgmt Mtg +END:VEVENT +BEGIN:VEVENT +SEQUENCE:6 +TRANSP:OPAQUE +UID:AAA9318E-37D9-4319-8626-95ECD3D3B243 +DTSTART;TZID=Pacific/Auckland:20071125T130000 +DTSTAMP:20071123T093223Z +SUMMARY:BBQ @ ML's +CREATED:20071123T093048Z +DTEND;TZID=Pacific/Auckland:20071125T190000 +LOCATION:ML's House +BEGIN:VALARM +X-WR-ALARMUID:2927836F-DF85-4688-901A-9ABE442BFB62 +ACTION:AUDIO +TRIGGER:-PT15M +ATTACH;VALUE=URI:Basso +END:VALARM END:VEVENT BEGIN:VTIMEZONE TZID:/mozilla.org/20050126_1/Antarctica/McMurdo diff --git a/testing/tests/regression-suite/902-PUT-collection.test b/testing/tests/regression-suite/902-PUT-collection.test index 2ac6ab3a..75d169df 100644 --- a/testing/tests/regression-suite/902-PUT-collection.test +++ b/testing/tests/regression-suite/902-PUT-collection.test @@ -676,5 +676,47 @@ ACTION:DISPLAY TRIGGER;VALUE=DURATION;RELATED=START:-PT15M END:VALARM END:VEVENT +BEGIN:VTIMEZONE +TZID:/softwarestudio.org/Olson_20011030_5/Pacific/Auckland +X-LIC-LOCATION:Pacific/Auckland +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +TZNAME:NZST +DTSTART:19700315T030000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 +END:STANDARD +BEGIN:DAYLIGHT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +TZNAME:NZDT +DTSTART:19701004T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 +END:DAYLIGHT +END:VTIMEZONE +BEGIN:VTIMEZONE +TZID:Pacific/Auckland +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +DTSTART:19900318T030000 +RRULE:FREQ=YEARLY;UNTIL=20070317T140000Z;BYMONTH=3;BYDAY=3SU +TZNAME:NZST +END:STANDARD +BEGIN:DAYLIGHT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +DTSTART:20070930T020000 +RRULE:FREQ=YEARLY;BYMONTH=9;BYDAY=-1SU +TZNAME:NZDT +END:DAYLIGHT +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +DTSTART:20080406T030000 +RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1SU +TZNAME:NZST +END:STANDARD +END:VTIMEZONE END:VCALENDAR ENDDATA diff --git a/testing/tests/regression-suite/903-GET-Collection.result b/testing/tests/regression-suite/903-GET-Collection.result index 05531ee4..d7a06e47 100644 --- a/testing/tests/regression-suite/903-GET-Collection.result +++ b/testing/tests/regression-suite/903-GET-Collection.result @@ -25,6 +25,198 @@ DESCRIPTION:Alan Wanston END:VALARM END:VEVENT BEGIN:VEVENT +UID:20061029T195821Z-14356-1000-1-12@ubu +DTSTAMP:20061029T195821Z +DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061030T130000 +DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061030T140000 +SUMMARY:??? +CREATED:20061029T195822 +LAST-MODIFIED:20061029T195822 +BEGIN:VALARM +X-EVOLUTION-ALARM-UID:20061029T195821Z-14353-1000-1-6@ubu +ACTION:DISPLAY +TRIGGER;VALUE=DURATION;RELATED=START:-PT15M +DESCRIPTION:??? +END:VALARM +END:VEVENT +BEGIN:VEVENT +UID:20061105T211651Z-4384-1000-1-7@ubu +DTSTAMP:20061105T211651Z +DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061107T140000 +DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061107T150000 +SUMMARY:James What +CREATED:20061105T211656 +LAST-MODIFIED:20061106T213310 +LOCATION:Copperstuff +CLASS:PUBLIC +TRANSP:OPAQUE +SEQUENCE:3 +ORGANIZER;CN=Andrew Moughtonbeigh:MAILTO:andrew@example.org +DESCRIPTION:I am looking at hosting a custom Web application on a Linux + Debian server. \nFrom what I understand you can provide the complete + solution in terms of hosting and support. \nI am currently looking into + hosting providers as well as looking for some Debian admin skilled + resource.\n +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE;CN=Andrew + Moughtonbeigh;LANGUAGE=en:MAILTO:andrew@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE;CN=Ian + Winsleigh;LANGUAGE=en:MAILTO:ian@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=David + Callenius;LANGUAGE=en:MAILTO:dcallenius@example.org +BEGIN:VALARM +X-EVOLUTION-ALARM-UID:20061106T213310Z-4382-1000-1-31@ubu +DESCRIPTION:James What +ACTION:DISPLAY +TRIGGER;VALUE=DURATION;RELATED=START:-PT15M +END:VALARM +END:VEVENT +BEGIN:VEVENT +UID:20061031T194148Z-14356-1000-1-14@ubu +DTSTAMP:20061031T194148Z +DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061101T133000 +DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061101T143000 +SUMMARY:Doctor +CREATED:20061031T194149 +LAST-MODIFIED:20061031T194149 +BEGIN:VALARM +X-EVOLUTION-ALARM-UID:20061031T194148Z-14353-1000-1-19@ubu +ACTION:DISPLAY +TRIGGER;VALUE=DURATION;RELATED=START:-PT15M +DESCRIPTION:Doctor +END:VALARM +END:VEVENT +BEGIN:VEVENT +UID:20061027T005242Z-5029-1001-1-1@dolmein +DTSTAMP:20061027T010232Z +DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061030T103000 +DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061030T113000 +TRANSP:OPAQUE +SEQUENCE:3 +SUMMARY:Interview Linus Pauling +CLASS:PRIVATE +CREATED:20061027T022816 +LAST-MODIFIED:20061027T022816 +DESCRIPTION:I've already spoken to each of you about this\, this is just + to ensure that it is in my calender :-) +ORGANIZER;CN=Ian Winsleigh:MAILTO:ian@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE;CN=Ian + Winsleigh;LANGUAGE=en:MAILTO:ian@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=Andrew + Moughtonbeigh;LANGUAGE=en;PARTSTAT=ACCEPTED:MAILTO:andrew@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=David + Callenius;LANGUAGE=en:MAILTO:dcallenius@example.org +X-MICROSOFT-CDO-REPLYTIME:20061027T022816Z +BEGIN:VALARM +X-EVOLUTION-ALARM-UID:20061027T022803Z-4264-1000-1-2@ubu +ACTION:DISPLAY +TRIGGER;VALUE=DURATION;RELATED=START:-PT15M +END:VALARM +END:VEVENT +BEGIN:VEVENT +X-LIC-ERROR;X-LIC-ERRORTYPE=VALUE-PARSE-ERROR:No value for UID property. + Removing entire property: +DTSTAMP:20061025T193258Z +DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061026T150000 +DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061026T160000 +TRANSP:OPAQUE +SEQUENCE:3 +SUMMARY:Performance Review - David C +CLASS:PRIVATE +ORGANIZER;CN=Ian Winsleigh:MAILTO:ian@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE;CN=Ian + Winsleigh;LANGUAGE=en:MAILTO:ian@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=David + Callenius;LANGUAGE=en;PARTSTAT=ACCEPTED:MAILTO:dcallenius@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=Andrew + Moughtonbeigh;LANGUAGE=en;PARTSTAT=ACCEPTED:MAILTO:andrew@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=David + Smith;LANGUAGE=en;PARTSTAT=ACCEPTED:MAILTO:dave2@example.org +CREATED:20061025T210902 +LAST-MODIFIED:20061025T210902 +UID:20061025T210650Z-21440-1000-1-8@ubu +X-MICROSOFT-CDO-REPLYTIME:20061025T210902Z +BEGIN:VALARM +X-EVOLUTION-ALARM-UID:20061025T210650Z-21440-1000-1-9@ubu +ACTION:DISPLAY +TRIGGER;VALUE=DURATION;RELATED=START:-PT15M +END:VALARM +END:VEVENT +BEGIN:VEVENT +UID:20061019T022314Z-5014-1001-1-1@dolmein +DTSTAMP:20061019T022452Z +DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061025T150000 +DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061025T160000 +TRANSP:OPAQUE +SEQUENCE:2 +SUMMARY:Performance Review - David C +CLASS:PRIVATE +ORGANIZER;CN=Ian Winsleigh:MAILTO:ian@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE;CN=Ian + Winsleigh;LANGUAGE=en:MAILTO:ian@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=David + Callenius;LANGUAGE=en:MAILTO:dcallenius@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=Andrew + Moughtonbeigh;LANGUAGE=en;PARTSTAT=ACCEPTED:MAILTO:andrew@example.org +ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=David + Smith;LANGUAGE=en:MAILTO:dave2@example.org +X-MICROSOFT-CDO-REPLYTIME:20061020T071245Z +CREATED:20061020T071245 +LAST-MODIFIED:20061020T071245 +BEGIN:VALARM +X-EVOLUTION-ALARM-UID:20061020T071222Z-7292-1000-1-2@ubu +ACTION:DISPLAY +TRIGGER;VALUE=DURATION;RELATED=START:-PT15M +END:VALARM +END:VEVENT +BEGIN:VEVENT +UID:20060918T011246Z-21151-1000-1-10@ubu +DTSTAMP:20060918T011246Z +DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20060928T173000 +DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20060928T200000 +SUMMARY:Summer Festival drinks at the loaded hog +CREATED:20060918T011251 +LAST-MODIFIED:20060918T011251 +BEGIN:VALARM +X-EVOLUTION-ALARM-UID:20060918T011246Z-21149-1000-1-20@ubu +ACTION:DISPLAY +TRIGGER;VALUE=DURATION;RELATED=START:-PT15M +DESCRIPTION:Summer Festival drinks at the loaded hog +END:VALARM +END:VEVENT +BEGIN:VEVENT +UID:20061029T195827Z-14356-1000-1-13@ubu +DTSTAMP:20061029T195827Z +DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061030T160000 +DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061030T170000 +SUMMARY:IZPAXY +CREATED:20061029T195828 +LAST-MODIFIED:20061029T195828 +BEGIN:VALARM +X-EVOLUTION-ALARM-UID:20061029T195827Z-14353-1000-1-7@ubu +ACTION:DISPLAY +TRIGGER;VALUE=DURATION;RELATED=START:-PT15M +DESCRIPTION:IZPAXY +END:VALARM +END:VEVENT +BEGIN:VEVENT +UID:20061011T232622Z-27447-1000-1-6@ubu +DTSTAMP:20061011T232622Z +DTSTART;TZID=/softwarestudio.org/Olson_20011030_4/Asia/Dubai:20061016T090000 +DTEND;TZID=/softwarestudio.org/Olson_20011030_4/Asia/Dubai:20061016T170000 +TRANSP:OPAQUE +SEQUENCE:3 +SUMMARY:Dubai Day +CLASS:PUBLIC +CREATED:20061011T232657 +LAST-MODIFIED:20061011T232731 +BEGIN:VALARM +X-EVOLUTION-ALARM-UID:20061011T232731Z-27445-1000-1-15@ubu +DESCRIPTION:Dubai Day +ACTION:DISPLAY +TRIGGER;VALUE=DURATION;RELATED=START:-PT15M +END:VALARM +END:VEVENT +BEGIN:VEVENT UID:86203AFD481A6C42892013E6E0C4845D039A2543@AKEXBE02.telecom.tcnz.net DTSTAMP:20061005T230724Z SUMMARY:Reminder for Mark for Absolom Livasathan's PGP WF Services cost @@ -215,21 +407,6 @@ TRIGGER;VALUE=DURATION;RELATED=START:-PT15M END:VALARM END:VEVENT BEGIN:VEVENT -UID:20061029T195821Z-14356-1000-1-12@ubu -DTSTAMP:20061029T195821Z -DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061030T130000 -DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061030T140000 -SUMMARY:??? -CREATED:20061029T195822 -LAST-MODIFIED:20061029T195822 -BEGIN:VALARM -X-EVOLUTION-ALARM-UID:20061029T195821Z-14353-1000-1-6@ubu -ACTION:DISPLAY -TRIGGER;VALUE=DURATION;RELATED=START:-PT15M -DESCRIPTION:??? -END:VALARM -END:VEVENT -BEGIN:VEVENT UID:20060907T213951Z-5189-1001-1-0@dolmein DTSTAMP:20060914T042719Z DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20060915T100000 @@ -436,183 +613,6 @@ ACTION:DISPLAY TRIGGER;VALUE=DURATION;RELATED=START:-PT15M END:VALARM END:VEVENT -BEGIN:VEVENT -UID:20061105T211651Z-4384-1000-1-7@ubu -DTSTAMP:20061105T211651Z -DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061107T140000 -DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061107T150000 -SUMMARY:James What -CREATED:20061105T211656 -LAST-MODIFIED:20061106T213310 -LOCATION:Copperstuff -CLASS:PUBLIC -TRANSP:OPAQUE -SEQUENCE:3 -ORGANIZER;CN=Andrew Moughtonbeigh:MAILTO:andrew@example.org -DESCRIPTION:I am looking at hosting a custom Web application on a Linux - Debian server. \nFrom what I understand you can provide the complete - solution in terms of hosting and support. \nI am currently looking into - hosting providers as well as looking for some Debian admin skilled - resource.\n -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE;CN=Andrew - Moughtonbeigh;LANGUAGE=en:MAILTO:andrew@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE;CN=Ian - Winsleigh;LANGUAGE=en:MAILTO:ian@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=David - Callenius;LANGUAGE=en:MAILTO:dcallenius@example.org -BEGIN:VALARM -X-EVOLUTION-ALARM-UID:20061106T213310Z-4382-1000-1-31@ubu -DESCRIPTION:James What -ACTION:DISPLAY -TRIGGER;VALUE=DURATION;RELATED=START:-PT15M -END:VALARM -END:VEVENT -BEGIN:VEVENT -UID:20061031T194148Z-14356-1000-1-14@ubu -DTSTAMP:20061031T194148Z -DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061101T133000 -DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061101T143000 -SUMMARY:Doctor -CREATED:20061031T194149 -LAST-MODIFIED:20061031T194149 -BEGIN:VALARM -X-EVOLUTION-ALARM-UID:20061031T194148Z-14353-1000-1-19@ubu -ACTION:DISPLAY -TRIGGER;VALUE=DURATION;RELATED=START:-PT15M -DESCRIPTION:Doctor -END:VALARM -END:VEVENT -BEGIN:VEVENT -UID:20061027T005242Z-5029-1001-1-1@dolmein -DTSTAMP:20061027T010232Z -DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061030T103000 -DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061030T113000 -TRANSP:OPAQUE -SEQUENCE:3 -SUMMARY:Interview Linus Pauling -CLASS:PRIVATE -CREATED:20061027T022816 -LAST-MODIFIED:20061027T022816 -DESCRIPTION:I've already spoken to each of you about this\, this is just - to ensure that it is in my calender :-) -ORGANIZER;CN=Ian Winsleigh:MAILTO:ian@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE;CN=Ian - Winsleigh;LANGUAGE=en:MAILTO:ian@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=Andrew - Moughtonbeigh;LANGUAGE=en;PARTSTAT=ACCEPTED:MAILTO:andrew@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=David - Callenius;LANGUAGE=en:MAILTO:dcallenius@example.org -X-MICROSOFT-CDO-REPLYTIME:20061027T022816Z -BEGIN:VALARM -X-EVOLUTION-ALARM-UID:20061027T022803Z-4264-1000-1-2@ubu -ACTION:DISPLAY -TRIGGER;VALUE=DURATION;RELATED=START:-PT15M -END:VALARM -END:VEVENT -BEGIN:VEVENT -X-LIC-ERROR;X-LIC-ERRORTYPE=VALUE-PARSE-ERROR:No value for UID property. - Removing entire property: -DTSTAMP:20061025T193258Z -DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061026T150000 -DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061026T160000 -TRANSP:OPAQUE -SEQUENCE:3 -SUMMARY:Performance Review - David C -CLASS:PRIVATE -ORGANIZER;CN=Ian Winsleigh:MAILTO:ian@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE;CN=Ian - Winsleigh;LANGUAGE=en:MAILTO:ian@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=David - Callenius;LANGUAGE=en;PARTSTAT=ACCEPTED:MAILTO:dcallenius@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=Andrew - Moughtonbeigh;LANGUAGE=en;PARTSTAT=ACCEPTED:MAILTO:andrew@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=David - Smith;LANGUAGE=en;PARTSTAT=ACCEPTED:MAILTO:dave2@example.org -CREATED:20061025T210902 -LAST-MODIFIED:20061025T210902 -UID:20061025T210650Z-21440-1000-1-8@ubu -X-MICROSOFT-CDO-REPLYTIME:20061025T210902Z -BEGIN:VALARM -X-EVOLUTION-ALARM-UID:20061025T210650Z-21440-1000-1-9@ubu -ACTION:DISPLAY -TRIGGER;VALUE=DURATION;RELATED=START:-PT15M -END:VALARM -END:VEVENT -BEGIN:VEVENT -UID:20061019T022314Z-5014-1001-1-1@dolmein -DTSTAMP:20061019T022452Z -DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061025T150000 -DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061025T160000 -TRANSP:OPAQUE -SEQUENCE:2 -SUMMARY:Performance Review - David C -CLASS:PRIVATE -ORGANIZER;CN=Ian Winsleigh:MAILTO:ian@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE;CN=Ian - Winsleigh;LANGUAGE=en:MAILTO:ian@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=David - Callenius;LANGUAGE=en:MAILTO:dcallenius@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=Andrew - Moughtonbeigh;LANGUAGE=en;PARTSTAT=ACCEPTED:MAILTO:andrew@example.org -ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=David - Smith;LANGUAGE=en:MAILTO:dave2@example.org -X-MICROSOFT-CDO-REPLYTIME:20061020T071245Z -CREATED:20061020T071245 -LAST-MODIFIED:20061020T071245 -BEGIN:VALARM -X-EVOLUTION-ALARM-UID:20061020T071222Z-7292-1000-1-2@ubu -ACTION:DISPLAY -TRIGGER;VALUE=DURATION;RELATED=START:-PT15M -END:VALARM -END:VEVENT -BEGIN:VEVENT -UID:20060918T011246Z-21151-1000-1-10@ubu -DTSTAMP:20060918T011246Z -DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20060928T173000 -DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20060928T200000 -SUMMARY:Summer Festival drinks at the loaded hog -CREATED:20060918T011251 -LAST-MODIFIED:20060918T011251 -BEGIN:VALARM -X-EVOLUTION-ALARM-UID:20060918T011246Z-21149-1000-1-20@ubu -ACTION:DISPLAY -TRIGGER;VALUE=DURATION;RELATED=START:-PT15M -DESCRIPTION:Summer Festival drinks at the loaded hog -END:VALARM -END:VEVENT -BEGIN:VEVENT -UID:20061029T195827Z-14356-1000-1-13@ubu -DTSTAMP:20061029T195827Z -DTSTART;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061030T160000 -DTEND;TZID=/softwarestudio.org/Olson_20011030_5/Pacific/Auckland:20061030T170000 -SUMMARY:IZPAXY -CREATED:20061029T195828 -LAST-MODIFIED:20061029T195828 -BEGIN:VALARM -X-EVOLUTION-ALARM-UID:20061029T195827Z-14353-1000-1-7@ubu -ACTION:DISPLAY -TRIGGER;VALUE=DURATION;RELATED=START:-PT15M -DESCRIPTION:IZPAXY -END:VALARM -END:VEVENT -BEGIN:VEVENT -UID:20061011T232622Z-27447-1000-1-6@ubu -DTSTAMP:20061011T232622Z -DTSTART;TZID=/softwarestudio.org/Olson_20011030_4/Asia/Dubai:20061016T090000 -DTEND;TZID=/softwarestudio.org/Olson_20011030_4/Asia/Dubai:20061016T170000 -TRANSP:OPAQUE -SEQUENCE:3 -SUMMARY:Dubai Day -CLASS:PUBLIC -CREATED:20061011T232657 -LAST-MODIFIED:20061011T232731 -BEGIN:VALARM -X-EVOLUTION-ALARM-UID:20061011T232731Z-27445-1000-1-15@ubu -DESCRIPTION:Dubai Day -ACTION:DISPLAY -TRIGGER;VALUE=DURATION;RELATED=START:-PT15M -END:VALARM -END:VEVENT BEGIN:VTIMEZONE TZID:Pacific/Auckland BEGIN:STANDARD From 39a7caa0f6b5443d314830be5146cd1b34e6a1f4 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 00:24:49 +1300 Subject: [PATCH 37/65] Some more changes to use a consistent id across collections and calendar data. --- dba/patches/1.2.1.sql | 74 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 dba/patches/1.2.1.sql diff --git a/dba/patches/1.2.1.sql b/dba/patches/1.2.1.sql new file mode 100644 index 00000000..60e7ac73 --- /dev/null +++ b/dba/patches/1.2.1.sql @@ -0,0 +1,74 @@ + +-- This database update provides new tables for the Principal, for +-- a consistent dav_resource which a principal, collection or calendar_item +-- all inherit from. + +BEGIN; +SELECT check_db_revision(1,1,12); + +-- Rename the caldav_data_dav_id_seq to dav_id_seq because we will use it +-- for more tables than just caldav_data +CREATE SEQUENCE dav_id_seq; +SELECT setval('dav_id_seq', nextval('caldav_data_dav_id_seq')); +ALTER TABLE caldav_data ALTER COLUMN dav_id SET DEFAULT nextval('dav_id_seq'); +ALTER TABLE calendar_item ALTER COLUMN dav_id SET DEFAULT nextval('dav_id_seq'); + +CREATE or REPLACE FUNCTION sync_dav_id ( ) RETURNS TRIGGER AS ' + DECLARE + BEGIN + + IF TG_OP = ''DELETE'' THEN + -- Just let the ON DELETE CASCADE handle this case + RETURN OLD; + END IF; + + IF NEW.dav_id IS NULL THEN + NEW.dav_id = nextval(''dav_id_seq''); + END IF; + + IF TG_OP = ''UPDATE'' THEN + IF OLD.dav_id = NEW.dav_id THEN + -- Nothing to do + RETURN NEW; + END IF; + END IF; + + IF TG_RELNAME = ''caldav_data'' THEN + UPDATE calendar_item SET dav_id = NEW.dav_id WHERE user_no = NEW.user_no AND dav_name = NEW.dav_name; + ELSE + UPDATE caldav_data SET dav_id = NEW.dav_id WHERE user_no = NEW.user_no AND dav_name = NEW.dav_name; + END IF; + + RETURN NEW; + + END +' LANGUAGE 'plpgsql'; + +-- CREATE TRIGGER caldav_data_sync_dav_id AFTER INSERT OR UPDATE ON caldav_data +-- FOR EACH ROW EXECUTE PROCEDURE sync_dav_id(); + +-- CREATE TRIGGER calendar_item_sync_dav_id AFTER INSERT OR UPDATE ON calendar_item +-- FOR EACH ROW EXECUTE PROCEDURE sync_dav_id(); + + +-- Add a numeric collection_id to collection +ALTER TABLE collection ADD COLUMN collection_id INT8; +UPDATE collection SET collection_id = nextval('dav_id_seq'); +ALTER TABLE collection ALTER COLUMN collection_id SET DEFAULT nextval('dav_id_seq'); +ALTER TABLE collection DROP CONSTRAINT collection_pkey CASCADE; +ALTER TABLE collection ADD UNIQUE (user_no,dav_name); +ALTER TABLE collection ADD CONSTRAINT collection_pkey PRIMARY KEY (collection_id); + +ALTER TABLE calendar_item ADD COLUMN collection_id INT8; +UPDATE calendar_item SET collection_id = collection.collection_id + FROM collection WHERE collection.dav_name = regexp_replace( calendar_item.dav_name, '/[^/]+$', '/'); +ALTER TABLE calendar_item ALTER COLUMN collection_id SET NOT NULL; +ALTER TABLE calendar_item ADD CONSTRAINT + calendar_item_collection_id_fkey FOREIGN KEY (collection_id) REFERENCES collection(collection_id); +CREATE INDEX calendar_item_collection_id_fkey ON calendar_item(collection_id,user_no); + +SELECT new_db_revision(1,2,1, 'Janvier' ); + +COMMIT; +ROLLBACK; + From 508d13f09c78b5c23eff1dda6403f5e6fd1225e8 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 00:25:34 +1300 Subject: [PATCH 38/65] Starting to implement the tables for the new permissions model. --- dba/patches/1.2.2.sql | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 dba/patches/1.2.2.sql diff --git a/dba/patches/1.2.2.sql b/dba/patches/1.2.2.sql new file mode 100644 index 00000000..2c9e9ea7 --- /dev/null +++ b/dba/patches/1.2.2.sql @@ -0,0 +1,70 @@ + +-- This database update provides new tables for the Principal, for +-- a consistent dav_resource which a principal, collection or calendar_item +-- all inherit from. + +BEGIN; +SELECT check_db_revision(1,2,1); + +-- Only needs SELECT access by website. +CREATE TABLE principal_type ( + principal_type_id SERIAL PRIMARY KEY, + principal_type_desc TEXT +); + +-- web needs SELECT,INSERT,UPDATE,DELETE +CREATE TABLE principal ( + principal_id SERIAL PRIMARY KEY, + type_id INT8 NOT NULL REFERENCES principal_type(principal_type_id), + user_no INT8 NULL REFERENCES usr(user_no), + displayname TEXT, + active BOOLEAN +); + +-- Allowing identification of group members. +CREATE TABLE group_member ( + group_id INT8 REFERENCES principal(principal_id), + member_id INT8 REFERENCES principal(principal_id) +); +CREATE UNIQUE INDEX group_member_pk ON group_member(group_id,member_id); +CREATE INDEX group_member_sk ON group_member(member_id); + + +-- Only needs SELECT access by website. dav_resource_type will be 'principal', 'collection', 'CalDAV:calendar' and so forth. +CREATE TABLE dav_resource_type ( + resource_type_id SERIAL PRIMARY KEY, + dav_resource_type TEXT, + resource_type_desc TEXT +); + +CREATE TABLE dav_resource ( + dav_id INT8 PRIMARY KEY DEFAULT nextval('dav_id_seq'), + dav_name TEXT, + resource_type_id INT8 REFERENCES dav_resource_type(resource_type_id), + owner_id INT8 REFERENCES principal(principal_id) +); + + +CREATE TABLE privilege ( + granted_to_id INT8 REFERENCES principal(principal_id), + resource_id INT8 REFERENCES dav_resource(dav_id), + granted_by_id INT8 REFERENCES principal(principal_id), + can_read BOOLEAN, + can_write BOOLEAN, + can_write_properties BOOLEAN, + can_write_content BOOLEAN, + can_unlock BOOLEAN, + can_read_acl BOOLEAN, + can_read_current_user_privilege_set BOOLEAN, + can_write_acl BOOLEAN, + can_bind BOOLEAN, + can_unbind BOOLEAN, + can_read_free_busy BOOLEAN, + PRIMARY KEY (granted_to_id, resource_id) +); + +SELECT new_db_revision(1,2,2, 'Fevrier' ); + +COMMIT; +ROLLBACK; + From 5859c8176333e8d017426ad61c397dce83a399be Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 00:26:09 +1300 Subject: [PATCH 39/65] We now depend on libyaml-perl, since we use that to read the configuration file for database updates. --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 9b0d0ddc..78e8ea1d 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper Package: rscds Architecture: all -Depends: debconf (>= 1.0.32), php5 | php4 (>= 4:4.3), php5-pgsql | php4-pgsql(>= 3:4.3.0), postgresql-client-8.2 | postgresql-client-8.1 | postgresql-client-8.0 | postgresql-client (>= 7.4), libawl-php (>=0.20), libclass-dbi-pg-perl, php5 | php4-domxml +Depends: debconf (>= 1.0.32), php5 | php4 (>= 4:4.3), php5-pgsql | php4-pgsql(>= 3:4.3.0), postgresql-client-8.2 | postgresql-client-8.1 | postgresql-client-8.0 | postgresql-client (>= 7.4), libawl-php (>=0.20), libclass-dbi-pg-perl, php5 | php4-domxml, libyaml-perl Description: DAViCal Calendar Server The DAViCal Calendar Server is designed to trivially store CalDAV calendars, such as those from Evolution, Sunbird/Lightning, From 7986056b59e416bb9bde3193060025df548cdb66 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 00:28:40 +1300 Subject: [PATCH 40/65] Ignore real configuration files. --- config/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/config/.gitignore b/config/.gitignore index 4f4773fb..097b256b 100644 --- a/config/.gitignore +++ b/config/.gitignore @@ -1 +1,2 @@ config.php +administration.yml From 4d97eced91781858998c9f94c24be8affd929c38 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 15:40:06 +1300 Subject: [PATCH 41/65] New files. --- davical.webprj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/davical.webprj b/davical.webprj index 2eec6308..1c456089 100644 --- a/davical.webprj +++ b/davical.webprj @@ -248,5 +248,9 @@ + + + + From 0bbf7d9a2cdc7b652c197bb88737cc094fba85ac Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 16:16:28 +1300 Subject: [PATCH 42/65] Cope with noisy file access denial such as open_basedir. --- inc/always.php | 10 +++++++++- inc/always.php.in | 11 ++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/inc/always.php b/inc/always.php index db477f2a..129feae9 100644 --- a/inc/always.php +++ b/inc/always.php @@ -9,6 +9,9 @@ // Ensure the configuration starts out as an empty object. unset($c); +// Ditto for a few other global things +unset($session); unset($request); unset($dbconn); + // Default some of the configurable values $c->sysabbr = 'davical'; $c->admin_email = 'admin@davical.example.com'; @@ -53,6 +56,11 @@ $c->protocol_server_port_script = sprintf( "%s://%s%s%s", (isset($_SERVER['HTTPS init_gettext( 'rscds', '../locale' ); +/** +* We use @file_exists because things like open_basedir might noisily deny +* access which could break DAViCal completely by causing output to start +* too early. +*/ if ( @file_exists("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php") ) { include_once("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php"); } @@ -85,7 +93,7 @@ awl_set_locale($c->default_locale); * */ $c->code_version = 0; -$c->version_string = '0.9.3'; // The actual version # is replaced into that during the build /release process +$c->version_string = '0.9.4'; // The actual version # is replaced into that during the build /release process if ( isset($c->version_string) && preg_match( '/(\d+)\.(\d+)\.(\d+)(.*)/', $c->version_string, $matches) ) { $c->code_major = $matches[1]; $c->code_minor = $matches[2]; diff --git a/inc/always.php.in b/inc/always.php.in index 2f32fa5b..cbfd7bd6 100644 --- a/inc/always.php.in +++ b/inc/always.php.in @@ -56,13 +56,18 @@ $c->protocol_server_port_script = sprintf( "%s://%s%s%s", (isset($_SERVER['HTTPS init_gettext( 'rscds', '../locale' ); -if ( file_exists("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php") ) { +/** +* We use @file_exists because things like open_basedir might noisily deny +* access which could break DAViCal completely by causing output to start +* too early. +*/ +if ( @file_exists("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php") ) { include_once("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php"); } -else if ( file_exists("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php") ) { +else if ( @file_exists("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php") ) { include_once("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php"); } -else if ( file_exists("../config/config.php") ) { +else if ( @file_exists("../config/config.php") ) { include_once("../config/config.php"); } else { From 8c41a091a7b5403c34134a6b6b0a38c192defbf1 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 16:17:01 +1300 Subject: [PATCH 43/65] About to release 0.9.4 --- VERSION | 2 +- debian/changelog | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 965065db..a602fc9e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.9.3 +0.9.4 diff --git a/debian/changelog b/debian/changelog index 6d302afc..4fef8dfa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +rscds (0.9.4) unstable; urgency=low + + * Performance improvements to get_permissions() + * Further performance improvements from bypassing get_permissions() + * Other performance improvements from refactoring queries + * Fix to .ics import to handle timezones correctly. + + -- Andrew McMillan Sat, 26 Jan 2008 16:12:30 +1300 + rscds (0.9.3) unstable; urgency=low * Start renaming to DAViCal internally and in documentation. @@ -11,7 +20,7 @@ rscds (0.9.3) unstable; urgency=low * Start to implement structured support for DAV Principals * Fixes to timezone handling. - -- Andrew McMillan Wed, 16 Jan 2008 21:55:31 +1300 + -- Andrew McMillan Wed, 23 Jan 2008 18:42:49 +1300 rscds (0.9.2) unstable; urgency=low From 7611f50a97f9898e8f7a8cdcb803dba85b25a1fa Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 16:33:37 +1300 Subject: [PATCH 44/65] Note more significant changes from 0.9.3 --- debian/changelog | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 4fef8dfa..c00bf84f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,8 +4,13 @@ rscds (0.9.4) unstable; urgency=low * Further performance improvements from bypassing get_permissions() * Other performance improvements from refactoring queries * Fix to .ics import to handle timezones correctly. + * Work around issues introduced when open_basedir is enabled. + * More rscds => davical renaming. + * Create users for the database for DBA and application use during + installation. + * Work around differences in authentication when PHP is used with FastCGI - -- Andrew McMillan Sat, 26 Jan 2008 16:12:30 +1300 + -- Andrew McMillan Sat, 26 Jan 2008 16:24:15 +1300 rscds (0.9.3) unstable; urgency=low From e5b246431b30bfd1bc6a0990caa8c5653cb3e223 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 21:55:05 +1300 Subject: [PATCH 45/65] Put collection_id on both caldav_data and calendar_item. --- dba/patches/1.2.1.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dba/patches/1.2.1.sql b/dba/patches/1.2.1.sql index 60e7ac73..11b696b7 100644 --- a/dba/patches/1.2.1.sql +++ b/dba/patches/1.2.1.sql @@ -67,6 +67,14 @@ ALTER TABLE calendar_item ADD CONSTRAINT calendar_item_collection_id_fkey FOREIGN KEY (collection_id) REFERENCES collection(collection_id); CREATE INDEX calendar_item_collection_id_fkey ON calendar_item(collection_id,user_no); +ALTER TABLE caldav_data ADD COLUMN collection_id INT8; +UPDATE caldav_data SET collection_id = collection.collection_id + FROM collection WHERE collection.dav_name = regexp_replace( caldav_data.dav_name, '/[^/]+$', '/'); +ALTER TABLE caldav_data ALTER COLUMN collection_id SET NOT NULL; +ALTER TABLE caldav_data ADD CONSTRAINT + caldav-data_collection_id_fkey FOREIGN KEY (collection_id) REFERENCES collection(collection_id); +CREATE INDEX caldav_data_collection_id_fkey ON caldav_data(collection_id,user_no); + SELECT new_db_revision(1,2,1, 'Janvier' ); COMMIT; From 577f6276619cf4b4e37fa9bf075843945872c622 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 21:55:47 +1300 Subject: [PATCH 46/65] Don't apply permissions to no-longer existing sequence. --- dba/appuser_permissions.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/dba/appuser_permissions.txt b/dba/appuser_permissions.txt index 09f212e4..27d863cc 100644 --- a/dba/appuser_permissions.txt +++ b/dba/appuser_permissions.txt @@ -36,7 +36,6 @@ GRANT SELECT,INSERT,UPDATE,DELETE ON privilege GRANT SELECT,UPDATE - ON caldav_data_dav_id_seq ON relationship_type_rt_id_seq ON dav_id_seq ON usr_user_no_seq From 7d6d62355909cdc430f6185d2fcf28fd962fe4ea Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 21:56:29 +1300 Subject: [PATCH 47/65] Use DDL for creating users since the createuser command probably isn't around on non-Debian systems. --- dba/create-database.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dba/create-database.sh b/dba/create-database.sh index f19c85d4..7ca7294b 100755 --- a/dba/create-database.sh +++ b/dba/create-database.sh @@ -38,7 +38,7 @@ db_users() { create_db_user() { if ! db_users | grep "^${1}$" >/dev/null ; then - createuser --no-superuser --no-createdb --no-createrole "${1}" + psql -qAt template1 -c "CREATE USER ${1} NOCREATEDB NOCREATEROLE;" fi } From 474265423707a16b245cb3f014fa970472da45ec Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 21:57:34 +1300 Subject: [PATCH 48/65] Update to 1.2.2 schema version. --- dba/davical.sql | 70 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/dba/davical.sql b/dba/davical.sql index 27ba688a..e24857a0 100644 --- a/dba/davical.sql +++ b/dba/davical.sql @@ -1,6 +1,8 @@ -- Really Simple CalDAV Store - Database Schema -- +CREATE SEQUENCE dav_id_seq; + -- Something that can look like a filesystem hierarchy where we store stuff CREATE TABLE collection ( user_no INT references usr(user_no) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, @@ -13,8 +15,8 @@ CREATE TABLE collection ( modified TIMESTAMP WITH TIME ZONE, public_events_only BOOLEAN NOT NULL DEFAULT FALSE, publicly_readable BOOLEAN NOT NULL DEFAULT FALSE, - - PRIMARY KEY ( user_no, dav_name ) + collection_id INT8 PRIMARY KEY DEFAULT nextval('dav_id_seq'), + UNIQUE(user_no,dav_name) ); @@ -28,7 +30,8 @@ CREATE TABLE caldav_data ( caldav_data TEXT, caldav_type TEXT, logged_user INT references usr(user_no), - dav_id SERIAL UNIQUE, + dav_id INT8 UNIQUE DEFAULT nextval('dav_id_seq'), + collection_id INT8 REFERENCES collection(collection_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, PRIMARY KEY ( user_no, dav_name ) ); @@ -69,6 +72,7 @@ CREATE TABLE calendar_item ( tz_id TEXT REFERENCES time_zone( tz_id ), status TEXT, dav_id INT8 UNIQUE, + collection_id INT8 REFERENCES collection(collection_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, -- Cascade updates / deletes from the caldav_data table CONSTRAINT caldav_exists FOREIGN KEY ( user_no, dav_name ) @@ -140,7 +144,7 @@ CREATE or REPLACE FUNCTION sync_dav_id ( ) RETURNS TRIGGER AS ' END IF; IF NEW.dav_id IS NULL THEN - NEW.dav_id = nextval(''caldav_data_dav_id_seq''); + NEW.dav_id = nextval(''dav_id_seq''); END IF; IF TG_OP = ''UPDATE'' THEN @@ -168,4 +172,62 @@ CREATE TRIGGER calendar_item_sync_dav_id AFTER INSERT OR UPDATE ON calendar_item FOR EACH ROW EXECUTE PROCEDURE sync_dav_id(); +-- Only needs SELECT access by website. +CREATE TABLE principal_type ( + principal_type_id SERIAL PRIMARY KEY, + principal_type_desc TEXT +); + +-- web needs SELECT,INSERT,UPDATE,DELETE +CREATE TABLE principal ( + principal_id SERIAL PRIMARY KEY, + type_id INT8 NOT NULL REFERENCES principal_type(principal_type_id), + user_no INT8 NULL REFERENCES usr(user_no), + displayname TEXT, + active BOOLEAN +); + +-- Allowing identification of group members. +CREATE TABLE group_member ( + group_id INT8 REFERENCES principal(principal_id), + member_id INT8 REFERENCES principal(principal_id) +); +CREATE UNIQUE INDEX group_member_pk ON group_member(group_id,member_id); +CREATE INDEX group_member_sk ON group_member(member_id); + + +-- Only needs SELECT access by website. dav_resource_type will be 'principal', 'collection', 'CalDAV:calendar' and so forth. +CREATE TABLE dav_resource_type ( + resource_type_id SERIAL PRIMARY KEY, + dav_resource_type TEXT, + resource_type_desc TEXT +); + +CREATE TABLE dav_resource ( + dav_id INT8 PRIMARY KEY DEFAULT nextval('dav_id_seq'), + dav_name TEXT, + resource_type_id INT8 REFERENCES dav_resource_type(resource_type_id), + owner_id INT8 REFERENCES principal(principal_id) +); + + +CREATE TABLE privilege ( + granted_to_id INT8 REFERENCES principal(principal_id), + resource_id INT8 REFERENCES dav_resource(dav_id), + granted_by_id INT8 REFERENCES principal(principal_id), + can_read BOOLEAN, + can_write BOOLEAN, + can_write_properties BOOLEAN, + can_write_content BOOLEAN, + can_unlock BOOLEAN, + can_read_acl BOOLEAN, + can_read_current_user_privilege_set BOOLEAN, + can_write_acl BOOLEAN, + can_bind BOOLEAN, + can_unbind BOOLEAN, + can_read_free_busy BOOLEAN, + PRIMARY KEY (granted_to_id, resource_id) +); + + SELECT new_db_revision(1,1,12, 'December' ); From 0365aeed7f358cc5cbec8290fbaa9f226d9f4808 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 21:59:02 +1300 Subject: [PATCH 49/65] Get the collection_id into the request variable. --- inc/CalDAVRequest.php | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index 2385c81d..bc7edaa6 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -154,21 +154,6 @@ class CalDAVRequest $this->DoResponse( 400, translate("The calendar path contains illegal characters.") ); } - /** - * RFC2518, 5.2: URL pointing to a collection SHOULD end in '/', and if it does not then - * we SHOULD return a Content-location header with the correction... - */ - if ( !preg_match( '#/$#', $this->path ) ) { - dbg_error_log( "caldav", "Checking whether path might be a collection" ); - $qry = new PgQuery( "SELECT count(1) AS is_collection FROM collection WHERE dav_name = ?;", $this->path . '/'); - if ( $qry->Exec('caldav') && $qry->rows == 1 && ($row = $qry->Fetch()) && $row->is_collection == 1 ) { - dbg_error_log( "caldav", "Path is actually a collection - sending Content-Location header." ); - $this->path .= '/'; - header( "Content-Location: $this->path" ); - $this->_is_collection = true; - } - } - $this->user_no = $session->user_no; $this->username = $session->username; @@ -180,6 +165,32 @@ class CalDAVRequest if ( isset($this->principal->username)) $this->username = $this->principal->username; if ( isset($this->principal->by_email)) $this->by_email = true; + /** + * RFC2518, 5.2: URL pointing to a collection SHOULD end in '/', and if it does not then + * we SHOULD return a Content-location header with the correction... + */ + if ( !preg_match( '#/$#', $this->path ) ) { + dbg_error_log( "caldav", "Checking whether path might be a collection" ); + $qry = new PgQuery( "SELECT collection_id FROM collection WHERE user_no = ? AND dav_name = ?;", $this->user_no, $this->path . '/'); + if ( $qry->Exec('caldav') && $qry->rows == 1 && ($row = $qry->Fetch()) ) { + dbg_error_log( "caldav", "Path is actually a collection - sending Content-Location header." ); + $this->path .= '/'; + header( "Content-Location: $this->path" ); + $this->_is_collection = true; + $this->collection_id = $row->collection_id; + } + } + + /** + * Get the ID of the collection we are referring to + */ + if ( !isset($this->collection_id) && preg_match( '#^(/.+/.+/)[^/]*$#', $this->path ) ) { + $qry = new PgQuery( "SELECT collection_id FROM collection WHERE user_no = ? AND dav_name = ?;", $this->user_no, $this->path ); + if ( $qry->Exec('caldav') && $qry->rows == 1 && ($row = $qry->Fetch()) ) { + $this->collection_id = $row->collection_id; + } + } + /** * Evaluate our permissions for accessing the target From 2cf34af02a1eb1fda84b72ce297e60affeb8e7b4 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 21:59:34 +1300 Subject: [PATCH 50/65] Formatting. --- inc/caldav-PUT.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/caldav-PUT.php b/inc/caldav-PUT.php index 13933273..5ed0ba0f 100644 --- a/inc/caldav-PUT.php +++ b/inc/caldav-PUT.php @@ -23,7 +23,7 @@ if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || $c->dbg['put']) ) { } include_once('caldav-PUT-functions.php'); -$is_collection = controlRequestContainer($request->username,$request->user_no, $request->path,true); +$is_collection = controlRequestContainer($request->username,$request->user_no, $request->path, true); $lock_opener = $request->FailIfLocked(); From e5ffe1ba9122fa51b176a331cfce5ae2127e2f05 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 22:17:58 +1300 Subject: [PATCH 51/65] Ensure newly created events get a collection_id on them. --- inc/caldav-PUT-functions.php | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/inc/caldav-PUT-functions.php b/inc/caldav-PUT-functions.php index 17c17def..a6d71a6c 100644 --- a/inc/caldav-PUT-functions.php +++ b/inc/caldav-PUT-functions.php @@ -68,7 +68,7 @@ function controlRequestContainer( $username, $user_no, $path, $caldav_context ) rollback_on_error( $caldav_context, $user_no, $path ); } if ( $qry->rows == 0 ) { - if ( preg_match( '#^(.*/)([^/]+/)$#', $request_container, $matches ) ) {//( + if ( preg_match( '#^(.*/)([^/]+)/$#', $request_container, $matches ) ) {//( $parent_container = $matches[1]; $displayname = $matches[2]; } @@ -176,6 +176,15 @@ function import_collection( $ics_content, $user_no, $path, $caldav_context ) { } dbg_error_log( "PUT", " Finished input after $lno lines" ); + $sql = "SELECT * FROM collection WHERE user_no = ? AND dav_name = ?;"; + $qry = new PgQuery( $sql, $user_no, $path ); + if ( ! $qry->Exec("PUT") ) rollback_on_error( $caldav_context, $user_no, $path ); + if ( ! $qry->rows == 1 ) { + dbg_error_log( "ERROR", " PUT: Collection does not exist at '%s' for user %d", $path, $user_no ); + rollback_on_error( $caldav_context, $user_no, $path ); + } + $collection = $qry->Fetch(); + $qry = new PgQuery("BEGIN; DELETE FROM calendar_item WHERE user_no=? AND dav_name ~ ?; DELETE FROM caldav_data WHERE user_no=? AND dav_name ~ ?;", $user_no, $path.'[^/]+$', $user_no, $path.'[^/]+$'); if ( !$qry->Exec("PUT") ) rollback_on_error( $caldav_context, $user_no, $path ); @@ -185,8 +194,8 @@ function import_collection( $ics_content, $user_no, $path, $caldav_context ) { $ic = new iCalendar( array( 'icalendar' => $icalendar ) ); $etag = md5($icalendar); $event_path = sprintf( "%s%d.ics", $path, $k); - $qry = new PgQuery( "INSERT INTO caldav_data ( user_no, dav_name, dav_etag, caldav_data, caldav_type, logged_user, created, modified ) VALUES( ?, ?, ?, ?, ?, ?, current_timestamp, current_timestamp )", - $user_no, $event_path, $etag, $icalendar, $ic->type, $session->user_no ); + $qry = new PgQuery( "INSERT INTO caldav_data ( user_no, dav_name, dav_etag, caldav_data, caldav_type, logged_user, created, modified, collection_id ) VALUES( ?, ?, ?, ?, ?, ?, current_timestamp, current_timestamp, ? )", + $user_no, $event_path, $etag, $icalendar, $ic->type, $session->user_no, $collection->collection_id ); if ( !$qry->Exec("PUT") ) rollback_on_error( $caldav_context, $user_no, $path ); $sql = ""; @@ -237,15 +246,15 @@ function import_collection( $ics_content, $user_no, $path, $caldav_context ) { $sql .= <<Get('uid'), $dtstamp, $ic->Get('dtstart'), $ic->Get('summary'), $ic->Get('location'), $class, $ic->Get('transp'), $ic->Get('description'), $ic->Get('rrule'), $ic->Get('tz_id'), $last_modified, $ic->Get('url'), $ic->Get('priority'), $ic->Get('created'), - $ic->Get('due'), $ic->Get('percent-complete') + $ic->Get('due'), $ic->Get('percent-complete'), $collection->collection_id ); if ( !$qry->Exec("PUT") ) rollback_on_error( $caldav_context, $user_no, $path); } @@ -328,8 +337,8 @@ function putCalendarResource( &$request, $author, $caldav_context ) { } if ( $put_action_type == 'INSERT' ) { - $qry = new PgQuery( "BEGIN; INSERT INTO caldav_data ( user_no, dav_name, dav_etag, caldav_data, caldav_type, logged_user, created, modified ) VALUES( ?, ?, ?, ?, ?, ?, current_timestamp, current_timestamp )", - $request->user_no, $request->path, $etag, $request->raw_post, $ic->type, $author ); + $qry = new PgQuery( "BEGIN; INSERT INTO caldav_data ( user_no, dav_name, dav_etag, caldav_data, caldav_type, logged_user, created, modified, collection_id ) VALUES( ?, ?, ?, ?, ?, ?, current_timestamp, current_timestamp, ? )", + $request->user_no, $request->path, $etag, $request->raw_post, $ic->type, $author, $request->collection_id ); if ( !$qry->Exec("PUT") ) rollback_on_error( $caldav_context, $request->user_no, $request->path); } else { @@ -386,8 +395,8 @@ function putCalendarResource( &$request, $author, $caldav_context ) { } $sql .= <<Get('DTSTART'), $ic->Get('SUMMARY'), $ic->Get('LOCATION'), $class, $ic->Get('TRANSP'), $ic->Get('DESCRIPTION'), $ic->Get('RRULE'), $ic->Get('TZ_ID'), $last_modified, $ic->Get('URL'), $ic->Get('PRIORITY'), $ic->Get('CREATED'), - $ic->Get('DUE'), $ic->Get('PERCENT-COMPLETE'), $ic->Get('STATUS') + $ic->Get('DUE'), $ic->Get('PERCENT-COMPLETE'), $ic->Get('STATUS'), $request->collection_id ); if ( !$qry->Exec("PUT") ) rollback_on_error( $caldav_context, $request->user_no, $request->path); dbg_error_log( "PUT", "User: %d, ETag: %s, Path: %s", $author, $etag, $request->path); From 435d228c70994cadd5205c14717cc7008c1fff3a Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 22:30:31 +1300 Subject: [PATCH 52/65] Actually retrieve the collection_id correctly, and document it too. --- inc/CalDAVRequest.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index bc7edaa6..121ab6ff 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -54,6 +54,16 @@ class CalDAVRequest */ var $user_agent; + /** + * The ID of the collection containing this path, or of this path if it is a collection + */ + var $collection_id; + + /** + * The path corresponding to the collection_id + */ + var $collection_path; + /** * Create a new CalDAVRequest object. */ @@ -178,18 +188,21 @@ class CalDAVRequest header( "Content-Location: $this->path" ); $this->_is_collection = true; $this->collection_id = $row->collection_id; + $this->collection_path = $this->path; } } /** * Get the ID of the collection we are referring to */ - if ( !isset($this->collection_id) && preg_match( '#^(/.+/.+/)[^/]*$#', $this->path ) ) { - $qry = new PgQuery( "SELECT collection_id FROM collection WHERE user_no = ? AND dav_name = ?;", $this->user_no, $this->path ); + if ( !isset($this->collection_id) && preg_match( '#^(/.+/.+/)[^/]*$#', $this->path, $matches ) ) { + $qry = new PgQuery( "SELECT collection_id FROM collection WHERE user_no = ? AND dav_name = ?;", $this->user_no, $matches[1] ); if ( $qry->Exec('caldav') && $qry->rows == 1 && ($row = $qry->Fetch()) ) { $this->collection_id = $row->collection_id; + $this->collection_path = $matches[1]; } } + dbg_error_log( "caldav", " Collection '%s' is %d", $this->collection_path, $this->collection_id ); /** From 894aeb96a2252532d15d9ac43d19fc87b46feae4 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 22:31:11 +1300 Subject: [PATCH 53/65] Apply the correct DB revision number. --- dba/davical.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dba/davical.sql b/dba/davical.sql index e24857a0..1f39ce01 100644 --- a/dba/davical.sql +++ b/dba/davical.sql @@ -230,4 +230,4 @@ CREATE TABLE privilege ( ); -SELECT new_db_revision(1,1,12, 'December' ); +SELECT new_db_revision(1,2,2, 'Fevrier' ); From 32ca626ba9db6f19b89d0f406a694e51c6ebe3cd Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 26 Jan 2008 22:31:29 +1300 Subject: [PATCH 54/65] Changes to test results. --- testing/tests/regression-suite/903-GET-Collection.result | 4 ++-- testing/tests/regression-suite/Create-Database.result | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/testing/tests/regression-suite/903-GET-Collection.result b/testing/tests/regression-suite/903-GET-Collection.result index d7a06e47..b42956f9 100644 --- a/testing/tests/regression-suite/903-GET-Collection.result +++ b/testing/tests/regression-suite/903-GET-Collection.result @@ -1,13 +1,13 @@ HTTP/1.1 200 OK Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -Content-Length: 24458 +Content-Length: 24457 Content-Type: text/calendar BEGIN:VCALENDAR PRODID:-//Catalyst.Net.NZ//NONSGML AWL Calendar//EN VERSION:2.0 -X-WR-CALNAME:entire/ +X-WR-CALNAME:entire BEGIN:VEVENT UID:20061119T201927Z-5105-1000-5103-8@ubu DTSTAMP:20061119T201927Z diff --git a/testing/tests/regression-suite/Create-Database.result b/testing/tests/regression-suite/Create-Database.result index fe8f849c..00213ba2 100644 --- a/testing/tests/regression-suite/Create-Database.result +++ b/testing/tests/regression-suite/Create-Database.result @@ -10,8 +10,6 @@ CREATE DATABASE (1 row) Supported locales updated. -DBD::Pg::db do failed: ERROR: relation "dav_id_seq" does not exist -DBD::Pg::db do failed: ERROR: relation "dav_id_seq" does not exist CalDAV functions updated. Database permissions updated. setval From 1afbfc4974548498d908f37ee92242009f4c5d64 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 27 Jan 2008 09:51:47 +1300 Subject: [PATCH 55/65] Ensure these patches will work in more obscure situations. --- dba/davical.sql | 24 ++++++++++++++---------- dba/patches/1.2.1.sql | 17 +++++++++++++---- dba/patches/1.2.2.sql | 18 +++++++++--------- 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/dba/davical.sql b/dba/davical.sql index 1f39ce01..57dd2783 100644 --- a/dba/davical.sql +++ b/dba/davical.sql @@ -35,7 +35,7 @@ CREATE TABLE caldav_data ( PRIMARY KEY ( user_no, dav_name ) ); - +CREATE INDEX caldav_data_collection_id_fkey ON caldav_data(collection_id); -- Not particularly needed, perhaps, except as a way to collect -- a bunch of valid iCalendar time zone specifications... :-) @@ -81,6 +81,7 @@ CREATE TABLE calendar_item ( PRIMARY KEY ( user_no, dav_name ) ); +CREATE INDEX calendar_item_collection_id_fkey ON calendar_item(collection_id); -- Each user can be related to each other user. This mechanism can also @@ -178,19 +179,21 @@ CREATE TABLE principal_type ( principal_type_desc TEXT ); + -- web needs SELECT,INSERT,UPDATE,DELETE CREATE TABLE principal ( principal_id SERIAL PRIMARY KEY, - type_id INT8 NOT NULL REFERENCES principal_type(principal_type_id), - user_no INT8 NULL REFERENCES usr(user_no), + type_id INT8 NOT NULL REFERENCES principal_type(principal_type_id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE, + user_no INT8 NULL REFERENCES usr(user_no) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, displayname TEXT, active BOOLEAN ); + -- Allowing identification of group members. CREATE TABLE group_member ( - group_id INT8 REFERENCES principal(principal_id), - member_id INT8 REFERENCES principal(principal_id) + group_id INT8 REFERENCES principal(principal_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, + member_id INT8 REFERENCES principal(principal_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE ); CREATE UNIQUE INDEX group_member_pk ON group_member(group_id,member_id); CREATE INDEX group_member_sk ON group_member(member_id); @@ -203,18 +206,19 @@ CREATE TABLE dav_resource_type ( resource_type_desc TEXT ); + CREATE TABLE dav_resource ( dav_id INT8 PRIMARY KEY DEFAULT nextval('dav_id_seq'), dav_name TEXT, - resource_type_id INT8 REFERENCES dav_resource_type(resource_type_id), - owner_id INT8 REFERENCES principal(principal_id) + resource_type_id INT8 REFERENCES dav_resource_type(resource_type_id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE, + owner_id INT8 REFERENCES principal(principal_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE ); CREATE TABLE privilege ( - granted_to_id INT8 REFERENCES principal(principal_id), - resource_id INT8 REFERENCES dav_resource(dav_id), - granted_by_id INT8 REFERENCES principal(principal_id), + granted_to_id INT8 REFERENCES principal(principal_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, + resource_id INT8 REFERENCES dav_resource(dav_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, + granted_by_id INT8 REFERENCES principal(principal_id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE, can_read BOOLEAN, can_write BOOLEAN, can_write_properties BOOLEAN, diff --git a/dba/patches/1.2.1.sql b/dba/patches/1.2.1.sql index 11b696b7..197a6457 100644 --- a/dba/patches/1.2.1.sql +++ b/dba/patches/1.2.1.sql @@ -60,20 +60,29 @@ ALTER TABLE collection ADD UNIQUE (user_no,dav_name); ALTER TABLE collection ADD CONSTRAINT collection_pkey PRIMARY KEY (collection_id); ALTER TABLE calendar_item ADD COLUMN collection_id INT8; +INSERT INTO collection ( user_no, parent_container, dav_name, dav_etag, dav_displayname, is_calendar, created, modified) + SELECT user_no, '/'||username||'/', '/'||username||'/home/', md5(user_no::text||'/'||username||'/home/'), + fullname, TRUE, current_timestamp, current_timestamp + FROM usr + WHERE NOT EXISTS (SELECT 1 FROM collection WHERE dav_name ~ ('^/'||username||'/')); + +UPDATE caldav_data SET dav_name = (select collection.dav_name FROM collection WHERE collection.user_no = caldav_data.user_no limit 1) + || regexp_replace( caldav_data.dav_name, '^.*/([^/]+)$', E'ex-\\1') + WHERE dav_name ~ '^/[^/]+/[^/]+$'; UPDATE calendar_item SET collection_id = collection.collection_id FROM collection WHERE collection.dav_name = regexp_replace( calendar_item.dav_name, '/[^/]+$', '/'); ALTER TABLE calendar_item ALTER COLUMN collection_id SET NOT NULL; ALTER TABLE calendar_item ADD CONSTRAINT - calendar_item_collection_id_fkey FOREIGN KEY (collection_id) REFERENCES collection(collection_id); -CREATE INDEX calendar_item_collection_id_fkey ON calendar_item(collection_id,user_no); + calendar_item_collection_id_fkey FOREIGN KEY (collection_id) REFERENCES collection(collection_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; +CREATE INDEX calendar_item_collection_id_fkey ON calendar_item(collection_id); ALTER TABLE caldav_data ADD COLUMN collection_id INT8; UPDATE caldav_data SET collection_id = collection.collection_id FROM collection WHERE collection.dav_name = regexp_replace( caldav_data.dav_name, '/[^/]+$', '/'); ALTER TABLE caldav_data ALTER COLUMN collection_id SET NOT NULL; ALTER TABLE caldav_data ADD CONSTRAINT - caldav-data_collection_id_fkey FOREIGN KEY (collection_id) REFERENCES collection(collection_id); -CREATE INDEX caldav_data_collection_id_fkey ON caldav_data(collection_id,user_no); + caldav_data_collection_id_fkey FOREIGN KEY (collection_id) REFERENCES collection(collection_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE; +CREATE INDEX caldav_data_collection_id_fkey ON caldav_data(collection_id); SELECT new_db_revision(1,2,1, 'Janvier' ); diff --git a/dba/patches/1.2.2.sql b/dba/patches/1.2.2.sql index 2c9e9ea7..472d9d69 100644 --- a/dba/patches/1.2.2.sql +++ b/dba/patches/1.2.2.sql @@ -15,16 +15,16 @@ CREATE TABLE principal_type ( -- web needs SELECT,INSERT,UPDATE,DELETE CREATE TABLE principal ( principal_id SERIAL PRIMARY KEY, - type_id INT8 NOT NULL REFERENCES principal_type(principal_type_id), - user_no INT8 NULL REFERENCES usr(user_no), + type_id INT8 NOT NULL REFERENCES principal_type(principal_type_id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE, + user_no INT8 NULL REFERENCES usr(user_no) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, displayname TEXT, active BOOLEAN ); -- Allowing identification of group members. CREATE TABLE group_member ( - group_id INT8 REFERENCES principal(principal_id), - member_id INT8 REFERENCES principal(principal_id) + group_id INT8 REFERENCES principal(principal_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, + member_id INT8 REFERENCES principal(principal_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE ); CREATE UNIQUE INDEX group_member_pk ON group_member(group_id,member_id); CREATE INDEX group_member_sk ON group_member(member_id); @@ -40,15 +40,15 @@ CREATE TABLE dav_resource_type ( CREATE TABLE dav_resource ( dav_id INT8 PRIMARY KEY DEFAULT nextval('dav_id_seq'), dav_name TEXT, - resource_type_id INT8 REFERENCES dav_resource_type(resource_type_id), - owner_id INT8 REFERENCES principal(principal_id) + resource_type_id INT8 REFERENCES dav_resource_type(resource_type_id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE, + owner_id INT8 REFERENCES principal(principal_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE ); CREATE TABLE privilege ( - granted_to_id INT8 REFERENCES principal(principal_id), - resource_id INT8 REFERENCES dav_resource(dav_id), - granted_by_id INT8 REFERENCES principal(principal_id), + granted_to_id INT8 REFERENCES principal(principal_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, + resource_id INT8 REFERENCES dav_resource(dav_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, + granted_by_id INT8 REFERENCES principal(principal_id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE, can_read BOOLEAN, can_write BOOLEAN, can_write_properties BOOLEAN, From a059beb8331e75b48badce1070cdc145b3b9d3f3 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 9 Feb 2008 21:20:55 +1300 Subject: [PATCH 56/65] When creating a fake event, don't create a blank RRULE. --- inc/caldav-GET.php | 5 +++-- inc/caldav-REPORT.php | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/inc/caldav-GET.php b/inc/caldav-GET.php index 7b21f8a3..d95c223b 100644 --- a/inc/caldav-GET.php +++ b/inc/caldav-GET.php @@ -61,9 +61,10 @@ else if ( $qry->rows > 1 ) { // if the event is confidential we fake one that just says "Busy" $confidential = new iCalendar( array( 'SUMMARY' => translate('Busy'), 'CLASS' => 'CONFIDENTIAL', - 'DTSTART' => $ical->Get('DTSTART'), - 'RRULE' => $ical->Get('RRULE') + 'DTSTART' => $ical->Get('DTSTART') ) ); + $rrule = $ical->Get('RRULE'); + if ( isset($rrule) && $rrule != '' ) $confidential->Set('RRULE', $rrule); $duration = $ical->Get('DURATION'); if ( isset($duration) && $duration != "" ) { $confidential->Set('DURATION', $duration ); diff --git a/inc/caldav-REPORT.php b/inc/caldav-REPORT.php index 79bedf80..3e63408a 100644 --- a/inc/caldav-REPORT.php +++ b/inc/caldav-REPORT.php @@ -77,9 +77,10 @@ function calendar_to_xml( $properties, $item ) { // if the event is confidential we fake one that just says "Busy" $confidential = new iCalendar( array( 'SUMMARY' => translate('Busy'), 'CLASS' => 'CONFIDENTIAL', - 'DTSTART' => $ical->Get('DTSTART'), - 'RRULE' => $ical->Get('RRULE') + 'DTSTART' => $ical->Get('DTSTART') ) ); + $rrule = $ical->Get('RRULE'); + if ( isset($rrule) && $rrule != '' ) $confidential->Set('RRULE', $rrule); $duration = $ical->Get('DURATION'); if ( isset($duration) && $duration != "" ) { $confidential->Set('DURATION', $duration ); From 934d0862f2dd558b5efb3964aab17b4ad296192f Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 9 Feb 2008 21:21:49 +1300 Subject: [PATCH 57/65] Recognise and error when the request says it has XML, but it has errors. --- inc/caldav-REPORT.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inc/caldav-REPORT.php b/inc/caldav-REPORT.php index 3e63408a..a2c52d74 100644 --- a/inc/caldav-REPORT.php +++ b/inc/caldav-REPORT.php @@ -26,6 +26,11 @@ if ( ! ($request->AllowedTo('read') || $request->AllowedTo('freebusy')) ) { if ( !isset($request->xml_tags) ) { $request->DoResponse( 403, "REPORT body contains no XML data!" ); } +$position = 0; +$xmltree = BuildXMLTree( $request->xml_tags, $position); +if ( !is_object($xmltree) ) { + $request->DoResponse( 403, "REPORT body is not valid XML data!" ); +} require_once("iCalendar.php"); @@ -35,8 +40,6 @@ $denied = array(); $unsupported = array(); if ( isset($prop_filter) ) unset($prop_filter); -$position = 0; -$xmltree = BuildXMLTree( $request->xml_tags, $position); if ( $xmltree->GetTag() == "URN:IETF:PARAMS:XML:NS:CALDAV:FREE-BUSY-QUERY" ) { include("caldav-REPORT-freebusy.php"); exit; // Not that the above include should return anyway From 8aba1b5a3bbbc010bda0615ec0bf18b3227a7546 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 9 Feb 2008 21:22:50 +1300 Subject: [PATCH 58/65] Change this request to include more results in the response. --- .../regression-suite/208-Moz-REPORT-5.data | 4 +- .../regression-suite/208-Moz-REPORT-5.result | 52 +++++++++++++++++-- .../regression-suite/208-Moz-REPORT-5.test | 5 +- 3 files changed, 54 insertions(+), 7 deletions(-) diff --git a/testing/tests/regression-suite/208-Moz-REPORT-5.data b/testing/tests/regression-suite/208-Moz-REPORT-5.data index ca0af781..1e078850 100644 --- a/testing/tests/regression-suite/208-Moz-REPORT-5.data +++ b/testing/tests/regression-suite/208-Moz-REPORT-5.data @@ -6,8 +6,8 @@ - + - \ No newline at end of file + diff --git a/testing/tests/regression-suite/208-Moz-REPORT-5.result b/testing/tests/regression-suite/208-Moz-REPORT-5.result index c09243d2..f7009e58 100644 --- a/testing/tests/regression-suite/208-Moz-REPORT-5.result +++ b/testing/tests/regression-suite/208-Moz-REPORT-5.result @@ -1,9 +1,55 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access -ETag: "07474790757c5e1b526ce4901889d6d3" -Content-Length: 68 +ETag: "5acea2c1bc8250bf55a3a32f155c0872" +Content-Length: 1343 Content-Type: text/xml; charset="utf-8" - + + + /caldav.php/user1/home/4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics + + + BEGIN:VCALENDAR +PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN +VERSION:2.0 +BEGIN:VEVENT +CREATED:20061120T041336Z +LAST-MODIFIED:20061120T041709Z +DTSTAMP:20061120T041709Z +UID:4aaf8f37-f232-4c8e-a72e-e171d4c4fe54 +SUMMARY:Weekly Project Meeting +PRIORITY:0 +CLASS:PUBLIC +RRULE:FREQ=WEEKLY;COUNT=26;INTERVAL=1;BYDAY=TH +DTSTART;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061102T100000 +DTEND;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061102T110000 +CATEGORIES:Projects +X-MOZ-LOCATIONPATH:4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics +END:VEVENT +BEGIN:VTIMEZONE +TZID:/mozilla.org/20050126_1/Pacific/Auckland +X-LIC-LOCATION:Pacific/Auckland +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +TZNAME:NZST +DTSTART:19700315T030000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 +END:STANDARD +BEGIN:DAYLIGHT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +TZNAME:NZDT +DTSTART:19701004T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 +END:DAYLIGHT +END:VTIMEZONE +END:VCALENDAR + + + HTTP/1.1 200 OK + + + diff --git a/testing/tests/regression-suite/208-Moz-REPORT-5.test b/testing/tests/regression-suite/208-Moz-REPORT-5.test index d4cd310b..2919442b 100644 --- a/testing/tests/regression-suite/208-Moz-REPORT-5.test +++ b/testing/tests/regression-suite/208-Moz-REPORT-5.test @@ -1,5 +1,6 @@ # -# Request a REPORT which should only include an instance of the repeating event we just added +# Request a REPORT including the event we just added along with a bunch of +# others. # TYPE=REPORT URL=http://mycaldav/caldav.php/user1/home/ @@ -11,4 +12,4 @@ HEADER=Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 HEADER=Keep-Alive: 300 HEADER=Content-Type: text/xml HEADER=Depth: 1 -HEAD \ No newline at end of file +HEAD From 0715dfcc47a42fa353cbbde9e7e30db7549cfb0a Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 9 Feb 2008 21:31:23 +1300 Subject: [PATCH 59/65] Additional regression tests and changes to sample data to handle REPORT differences for read, or read/write access to calendars. --- dba/sample-data.sql | 2 + .../regression-suite/218-Moz-REPORT.result | 118 ++++++++++++++++++ .../regression-suite/218-Moz-REPORT.test | 17 +++ .../regression-suite/219-Moz-REPORT.result | 118 ++++++++++++++++++ .../regression-suite/219-Moz-REPORT.test | 17 +++ .../regression-suite/220-Moz-REPORT.result | 7 ++ .../regression-suite/220-Moz-REPORT.test | 17 +++ 7 files changed, 296 insertions(+) create mode 100644 testing/tests/regression-suite/218-Moz-REPORT.result create mode 100644 testing/tests/regression-suite/218-Moz-REPORT.test create mode 100644 testing/tests/regression-suite/219-Moz-REPORT.result create mode 100644 testing/tests/regression-suite/219-Moz-REPORT.test create mode 100644 testing/tests/regression-suite/220-Moz-REPORT.result create mode 100644 testing/tests/regression-suite/220-Moz-REPORT.test diff --git a/dba/sample-data.sql b/dba/sample-data.sql index 467f08a4..5022d96f 100644 --- a/dba/sample-data.sql +++ b/dba/sample-data.sql @@ -23,6 +23,7 @@ INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullna INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullname, email ) VALUES( 30, TRUE, current_date, current_date, 'assistant1', '**assistant1', 'Assistant 1', 'assistant1@example.net' ); + INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullname, email ) VALUES( 100, TRUE, current_date, current_date, 'resource1', '*salt*unpossible', 'Resource 1', 'resource1@example.net' ); INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullname, email ) @@ -53,6 +54,7 @@ INSERT INTO relationship ( from_user, to_user, rt_id ) VALUES( 30, 200, 1 ); -- Between a PA and their Manager INSERT INTO relationship ( from_user, to_user, rt_id ) VALUES( 30, 20, 2 ); +INSERT INTO relationship ( from_user, to_user, rt_id ) VALUES( 30, 10, 2 ); -- Between a team INSERT INTO relationship ( from_user, to_user, rt_id ) VALUES( 20, 300, 3 ); diff --git a/testing/tests/regression-suite/218-Moz-REPORT.result b/testing/tests/regression-suite/218-Moz-REPORT.result new file mode 100644 index 00000000..f44392a4 --- /dev/null +++ b/testing/tests/regression-suite/218-Moz-REPORT.result @@ -0,0 +1,118 @@ +HTTP/1.1 207 Multi-Status +Date: Dow, 01 Jan 2000 00:00:00 GMT +DAV: 1, 2, access-control, calendar-access +ETag: "f7c12929e08c550e63f2fb435ed40c85" +Content-Length: 3002 +Content-Type: text/xml; charset="utf-8" + + + + + /caldav.php/user1/home/4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics + + + BEGIN:VCALENDAR +PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN +VERSION:2.0 +BEGIN:VEVENT +CREATED:20061120T041336Z +LAST-MODIFIED:20061120T041709Z +DTSTAMP:20061120T041709Z +UID:4aaf8f37-f232-4c8e-a72e-e171d4c4fe54 +SUMMARY:Weekly Project Meeting +PRIORITY:0 +CLASS:PUBLIC +RRULE:FREQ=WEEKLY;COUNT=26;INTERVAL=1;BYDAY=TH +DTSTART;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061102T100000 +DTEND;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061102T110000 +CATEGORIES:Projects +X-MOZ-LOCATIONPATH:4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics +END:VEVENT +BEGIN:VTIMEZONE +TZID:/mozilla.org/20050126_1/Pacific/Auckland +X-LIC-LOCATION:Pacific/Auckland +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +TZNAME:NZST +DTSTART:19700315T030000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 +END:STANDARD +BEGIN:DAYLIGHT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +TZNAME:NZDT +DTSTART:19701004T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 +END:DAYLIGHT +END:VTIMEZONE +END:VCALENDAR + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/9d050be7-8a02-4355-8ed3-02a9fc5f473f.ics + + + BEGIN:VCALENDAR +PRODID:-//Catalyst.Net.NZ//NONSGML AWL Calendar//EN +VERSION:2.0 +BEGIN:VEVENT +SUMMARY:Busy +CLASS:CONFIDENTIAL +DTSTART:20061223T160000 +DTEND:20061223T180000 +END:VEVENT +END:VCALENDAR + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics + + + BEGIN:VCALENDAR +PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN +VERSION:2.0 +BEGIN:VEVENT +CREATED:20061223T051646Z +LAST-MODIFIED:20061223T051713Z +DTSTAMP:20061223T051713Z +UID:fbd57454-d966-4a14-8341-abe1edb1ae66 +SUMMARY:Tentative Event +STATUS:TENTATIVE +CLASS:PUBLIC +DTSTART;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T190000 +DTEND;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T210000 +X-MOZ-LOCATIONPATH:fbd57454-d966-4a14-8341-abe1edb1ae66.ics +LOCATION:Never never land +END:VEVENT +BEGIN:VTIMEZONE +TZID:/mozilla.org/20050126_1/Antarctica/McMurdo +X-LIC-LOCATION:Antarctica/McMurdo +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +TZNAME:NZST +DTSTART:19700315T030000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 +END:STANDARD +BEGIN:DAYLIGHT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +TZNAME:NZDT +DTSTART:19701004T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 +END:DAYLIGHT +END:VTIMEZONE +END:VCALENDAR + + + HTTP/1.1 200 OK + + + diff --git a/testing/tests/regression-suite/218-Moz-REPORT.test b/testing/tests/regression-suite/218-Moz-REPORT.test new file mode 100644 index 00000000..fa7e3f54 --- /dev/null +++ b/testing/tests/regression-suite/218-Moz-REPORT.test @@ -0,0 +1,17 @@ +# +# Request a REPORT as a user with read only access. +# +TYPE=REPORT +AUTH=manager1:manager1 +URL=http://mycaldav/caldav.php/user1/home/ +HEADER=User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20061108 Calendar/0.4a1 +HEADER=Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 +HEADER=Accept-Language: en-us,en;q=0.5 +HEADER=Accept-Encoding: gzip,deflate +HEADER=Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 +HEADER=Keep-Alive: 300 +HEADER=Content-Type: text/xml +HEADER=Depth: 1 +HEAD + +DATA=208-Moz-REPORT-5 diff --git a/testing/tests/regression-suite/219-Moz-REPORT.result b/testing/tests/regression-suite/219-Moz-REPORT.result new file mode 100644 index 00000000..f44392a4 --- /dev/null +++ b/testing/tests/regression-suite/219-Moz-REPORT.result @@ -0,0 +1,118 @@ +HTTP/1.1 207 Multi-Status +Date: Dow, 01 Jan 2000 00:00:00 GMT +DAV: 1, 2, access-control, calendar-access +ETag: "f7c12929e08c550e63f2fb435ed40c85" +Content-Length: 3002 +Content-Type: text/xml; charset="utf-8" + + + + + /caldav.php/user1/home/4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics + + + BEGIN:VCALENDAR +PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN +VERSION:2.0 +BEGIN:VEVENT +CREATED:20061120T041336Z +LAST-MODIFIED:20061120T041709Z +DTSTAMP:20061120T041709Z +UID:4aaf8f37-f232-4c8e-a72e-e171d4c4fe54 +SUMMARY:Weekly Project Meeting +PRIORITY:0 +CLASS:PUBLIC +RRULE:FREQ=WEEKLY;COUNT=26;INTERVAL=1;BYDAY=TH +DTSTART;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061102T100000 +DTEND;TZID=/mozilla.org/20050126_1/Pacific/Auckland:20061102T110000 +CATEGORIES:Projects +X-MOZ-LOCATIONPATH:4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics +END:VEVENT +BEGIN:VTIMEZONE +TZID:/mozilla.org/20050126_1/Pacific/Auckland +X-LIC-LOCATION:Pacific/Auckland +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +TZNAME:NZST +DTSTART:19700315T030000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 +END:STANDARD +BEGIN:DAYLIGHT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +TZNAME:NZDT +DTSTART:19701004T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 +END:DAYLIGHT +END:VTIMEZONE +END:VCALENDAR + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/9d050be7-8a02-4355-8ed3-02a9fc5f473f.ics + + + BEGIN:VCALENDAR +PRODID:-//Catalyst.Net.NZ//NONSGML AWL Calendar//EN +VERSION:2.0 +BEGIN:VEVENT +SUMMARY:Busy +CLASS:CONFIDENTIAL +DTSTART:20061223T160000 +DTEND:20061223T180000 +END:VEVENT +END:VCALENDAR + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics + + + BEGIN:VCALENDAR +PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN +VERSION:2.0 +BEGIN:VEVENT +CREATED:20061223T051646Z +LAST-MODIFIED:20061223T051713Z +DTSTAMP:20061223T051713Z +UID:fbd57454-d966-4a14-8341-abe1edb1ae66 +SUMMARY:Tentative Event +STATUS:TENTATIVE +CLASS:PUBLIC +DTSTART;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T190000 +DTEND;TZID=/mozilla.org/20050126_1/Antarctica/McMurdo:20061223T210000 +X-MOZ-LOCATIONPATH:fbd57454-d966-4a14-8341-abe1edb1ae66.ics +LOCATION:Never never land +END:VEVENT +BEGIN:VTIMEZONE +TZID:/mozilla.org/20050126_1/Antarctica/McMurdo +X-LIC-LOCATION:Antarctica/McMurdo +BEGIN:STANDARD +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +TZNAME:NZST +DTSTART:19700315T030000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=3SU;BYMONTH=3 +END:STANDARD +BEGIN:DAYLIGHT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +TZNAME:NZDT +DTSTART:19701004T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=10 +END:DAYLIGHT +END:VTIMEZONE +END:VCALENDAR + + + HTTP/1.1 200 OK + + + diff --git a/testing/tests/regression-suite/219-Moz-REPORT.test b/testing/tests/regression-suite/219-Moz-REPORT.test new file mode 100644 index 00000000..45a0ff7a --- /dev/null +++ b/testing/tests/regression-suite/219-Moz-REPORT.test @@ -0,0 +1,17 @@ +# +# Request a REPORT as a user with read/write access +# +TYPE=REPORT +AUTH=assistant1:assistant1 +URL=http://mycaldav/caldav.php/user1/home/ +HEADER=User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20061108 Calendar/0.4a1 +HEADER=Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 +HEADER=Accept-Language: en-us,en;q=0.5 +HEADER=Accept-Encoding: gzip,deflate +HEADER=Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 +HEADER=Keep-Alive: 300 +HEADER=Content-Type: text/xml +HEADER=Depth: 1 +HEAD + +DATA=208-Moz-REPORT-5 diff --git a/testing/tests/regression-suite/220-Moz-REPORT.result b/testing/tests/regression-suite/220-Moz-REPORT.result new file mode 100644 index 00000000..64067c1c --- /dev/null +++ b/testing/tests/regression-suite/220-Moz-REPORT.result @@ -0,0 +1,7 @@ +HTTP/1.1 403 Forbidden +Date: Dow, 01 Jan 2000 00:00:00 GMT +DAV: 1, 2, access-control, calendar-access +Content-Length: 34 +Content-Type: text/plain; charset="utf-8" + +REPORT body is not valid XML data! \ No newline at end of file diff --git a/testing/tests/regression-suite/220-Moz-REPORT.test b/testing/tests/regression-suite/220-Moz-REPORT.test new file mode 100644 index 00000000..35127ef5 --- /dev/null +++ b/testing/tests/regression-suite/220-Moz-REPORT.test @@ -0,0 +1,17 @@ +# +# Request a REPORT but don't send any actual valid XML data(!) +# +TYPE=REPORT +URL=http://mycaldav/caldav.php/user1/home/ +HEADER=User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20061108 Calendar/0.4a1 +HEADER=Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 +HEADER=Accept-Language: en-us,en;q=0.5 +HEADER=Accept-Encoding: gzip,deflate +HEADER=Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 +HEADER=Keep-Alive: 300 +HEADER=Content-Type: text/xml +HEADER=Depth: 1 +HEAD + +BEGINDATA +ENDDATA From fc8352baf307b711b2b47a863bf65a11ccaf90b9 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 9 Feb 2008 22:49:05 +1300 Subject: [PATCH 60/65] Those error messages should be translatable. --- inc/caldav-REPORT.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/caldav-REPORT.php b/inc/caldav-REPORT.php index a2c52d74..e4c93244 100644 --- a/inc/caldav-REPORT.php +++ b/inc/caldav-REPORT.php @@ -24,12 +24,12 @@ if ( ! ($request->AllowedTo('read') || $request->AllowedTo('freebusy')) ) { } if ( !isset($request->xml_tags) ) { - $request->DoResponse( 403, "REPORT body contains no XML data!" ); + $request->DoResponse( 403, translate("REPORT body contains no XML data!") ); } $position = 0; $xmltree = BuildXMLTree( $request->xml_tags, $position); if ( !is_object($xmltree) ) { - $request->DoResponse( 403, "REPORT body is not valid XML data!" ); + $request->DoResponse( 403, translate("REPORT body is not valid XML data!") ); } require_once("iCalendar.php"); From 976b09c9e3652a347838145d25f81d7c071c4081 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 9 Feb 2008 22:50:10 +1300 Subject: [PATCH 61/65] Updated translation strings. --- po/de_DE.po | 8 +++++++- po/en_NZ.po | 8 +++++++- po/es_AR.po | 8 +++++++- po/es_ES.po | 8 +++++++- po/es_MX.po | 8 +++++++- po/fr_FR.po | 8 +++++++- po/hu_HU.po | 8 +++++++- po/messages.po | 8 +++++++- po/nl_NL.po | 8 +++++++- po/pl_PL.po | 8 +++++++- po/ru_RU.po | 8 +++++++- 11 files changed, 77 insertions(+), 11 deletions(-) diff --git a/po/de_DE.po b/po/de_DE.po index 10743336..3adade17 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: RSCDS 0.2.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-17 22:06+1300\n" +"POT-Creation-Date: 2008-02-09 22:49+1300\n" "PO-Revision-Date: 2006-11-06 17:24+1300\n" "Last-Translator: Cristina Radalescu \n" "MIME-Version: 1.0\n" @@ -361,6 +361,12 @@ msgstr "Öffentlich" msgid "Public" msgstr "Öffentlich" +msgid "REPORT body contains no XML data!" +msgstr "" + +msgid "REPORT body is not valid XML data!" +msgstr "" + msgid "Really Simple CalDAV Store" msgstr "Wirklich einfacher CalDAV Store" diff --git a/po/en_NZ.po b/po/en_NZ.po index 32f6d3df..c5ed9762 100644 --- a/po/en_NZ.po +++ b/po/en_NZ.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-17 22:06+1300\n" +"POT-Creation-Date: 2008-02-09 22:49+1300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -347,6 +347,12 @@ msgstr "" msgid "Public" msgstr "" +msgid "REPORT body contains no XML data!" +msgstr "" + +msgid "REPORT body is not valid XML data!" +msgstr "" + msgid "Really Simple CalDAV Store" msgstr "" diff --git a/po/es_AR.po b/po/es_AR.po index 53e616f5..3ee59984 100644 --- a/po/es_AR.po +++ b/po/es_AR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: RSCDS 0.2.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-17 22:06+1300\n" +"POT-Creation-Date: 2008-02-09 22:49+1300\n" "PO-Revision-Date: 2006-11-06 17:12+1300\n" "Last-Translator: Lorena Paoletti \n" "Language-Team: LANGUAGE \n" @@ -359,6 +359,12 @@ msgstr "Público" msgid "Public" msgstr "Público" +msgid "REPORT body contains no XML data!" +msgstr "" + +msgid "REPORT body is not valid XML data!" +msgstr "" + msgid "Really Simple CalDAV Store" msgstr "Almacenamiento CalDAV realmente simple" diff --git a/po/es_ES.po b/po/es_ES.po index 53e616f5..3ee59984 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: RSCDS 0.2.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-17 22:06+1300\n" +"POT-Creation-Date: 2008-02-09 22:49+1300\n" "PO-Revision-Date: 2006-11-06 17:12+1300\n" "Last-Translator: Lorena Paoletti \n" "Language-Team: LANGUAGE \n" @@ -359,6 +359,12 @@ msgstr "Público" msgid "Public" msgstr "Público" +msgid "REPORT body contains no XML data!" +msgstr "" + +msgid "REPORT body is not valid XML data!" +msgstr "" + msgid "Really Simple CalDAV Store" msgstr "Almacenamiento CalDAV realmente simple" diff --git a/po/es_MX.po b/po/es_MX.po index 53e616f5..3ee59984 100644 --- a/po/es_MX.po +++ b/po/es_MX.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: RSCDS 0.2.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-17 22:06+1300\n" +"POT-Creation-Date: 2008-02-09 22:49+1300\n" "PO-Revision-Date: 2006-11-06 17:12+1300\n" "Last-Translator: Lorena Paoletti \n" "Language-Team: LANGUAGE \n" @@ -359,6 +359,12 @@ msgstr "Público" msgid "Public" msgstr "Público" +msgid "REPORT body contains no XML data!" +msgstr "" + +msgid "REPORT body is not valid XML data!" +msgstr "" + msgid "Really Simple CalDAV Store" msgstr "Almacenamiento CalDAV realmente simple" diff --git a/po/fr_FR.po b/po/fr_FR.po index c5a2e614..23730939 100644 --- a/po/fr_FR.po +++ b/po/fr_FR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: rscds 0.3.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-17 22:06+1300\n" +"POT-Creation-Date: 2008-02-09 22:49+1300\n" "PO-Revision-Date: 2006-11-13 13:03+1300\n" "Last-Translator: maxime delorme \n" "Language-Team: LANGUAGE \n" @@ -383,6 +383,12 @@ msgstr "Public" msgid "Public" msgstr "Public" +msgid "REPORT body contains no XML data!" +msgstr "" + +msgid "REPORT body is not valid XML data!" +msgstr "" + # This is the (current, working) name of the application. It may change # if I (or someone else) can think of a better one. It's optional to # translate it. diff --git a/po/hu_HU.po b/po/hu_HU.po index 83499af3..67a3b65c 100644 --- a/po/hu_HU.po +++ b/po/hu_HU.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: rscds 0.7.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-17 22:06+1300\n" +"POT-Creation-Date: 2008-02-09 22:49+1300\n" "PO-Revision-Date: 2007-05-03 15:00+0001\n" "Last-Translator: David Takacs \n" "Language-Team: \n" @@ -351,6 +351,12 @@ msgstr "Nyilvános" msgid "Public" msgstr "Nyilvános" +msgid "REPORT body contains no XML data!" +msgstr "" + +msgid "REPORT body is not valid XML data!" +msgstr "" + msgid "Really Simple CalDAV Store" msgstr "Really Simple CalDAV Store" diff --git a/po/messages.po b/po/messages.po index 50fd8ac8..b40cb789 100644 --- a/po/messages.po +++ b/po/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-17 22:06+1300\n" +"POT-Creation-Date: 2008-02-09 22:49+1300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -354,6 +354,12 @@ msgstr "" msgid "Public" msgstr "" +msgid "REPORT body contains no XML data!" +msgstr "" + +msgid "REPORT body is not valid XML data!" +msgstr "" + msgid "Really Simple CalDAV Store" msgstr "" diff --git a/po/nl_NL.po b/po/nl_NL.po index 1f95aece..6c208e71 100644 --- a/po/nl_NL.po +++ b/po/nl_NL.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-17 22:06+1300\n" +"POT-Creation-Date: 2008-02-09 22:49+1300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Eelco Maljaars \n" "Language-Team: nl_NL \n" @@ -355,6 +355,12 @@ msgstr "Publiek" msgid "Public" msgstr "Publiek" +msgid "REPORT body contains no XML data!" +msgstr "" + +msgid "REPORT body is not valid XML data!" +msgstr "" + msgid "Really Simple CalDAV Store" msgstr "Erg Simpele CalDAV Opslag" diff --git a/po/pl_PL.po b/po/pl_PL.po index 1ea50733..8c39bd51 100644 --- a/po/pl_PL.po +++ b/po/pl_PL.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: rscds-messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-17 22:06+1300\n" +"POT-Creation-Date: 2008-02-09 22:49+1300\n" "PO-Revision-Date: 2007-03-31 00:24+0200\n" "Last-Translator: Rafal Slubowski \n" "Language-Team: polski \n" @@ -353,6 +353,12 @@ msgstr "Ogólnodostępny" msgid "Public" msgstr "Publiczny" +msgid "REPORT body contains no XML data!" +msgstr "" + +msgid "REPORT body is not valid XML data!" +msgstr "" + msgid "Really Simple CalDAV Store" msgstr "Bardzo prosta składnica CalDAV" diff --git a/po/ru_RU.po b/po/ru_RU.po index 2a9bbdda..80d484d4 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: rscds 0.3.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-17 22:06+1300\n" +"POT-Creation-Date: 2008-02-09 22:49+1300\n" "PO-Revision-Date: 2006-11-13 23:07+0500\n" "Last-Translator: Nick Khazov \n" "Language-Team: LANGUAGE \n" @@ -362,6 +362,12 @@ msgstr "" msgid "Public" msgstr "" +msgid "REPORT body contains no XML data!" +msgstr "" + +msgid "REPORT body is not valid XML data!" +msgstr "" + msgid "Really Simple CalDAV Store" msgstr "Действительно простое хранилище CalDAV" From 0f4d5dc4648246ae18331e3029f41a81de9d83f1 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 9 Feb 2008 22:50:44 +1300 Subject: [PATCH 62/65] Change the /etc/ directory name. --- debian/rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index 0f4452c4..af4d7bb1 100755 --- a/debian/rules +++ b/debian/rules @@ -4,6 +4,7 @@ # package=rscds +newname=davical dt=debian/$(package) build: inc htdocs debian @@ -22,9 +23,8 @@ binary-indep: checkroot build -rm -rf $(dt) dh_clean -k # dh_installdebconf - install -d $(dt) $(dt)/DEBIAN $(dt)/etc/$(package) \ - $(dt)/usr/share/$(package) $(dt)/usr/share/doc/$(package) \ - $(dt)/var/lib/$(package) + install -d $(dt) $(dt)/DEBIAN $(dt)/etc/$(newname) \ + $(dt)/usr/share/$(package) $(dt)/usr/share/doc/$(package) cp -a htdocs $(dt)/usr/share/$(package) cp -a dba $(dt)/usr/share/$(package) cp -a inc $(dt)/usr/share/$(package) From e32df146db719a7588786fc784eafc00b8c50012 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 9 Feb 2008 22:51:41 +1300 Subject: [PATCH 63/65] Attempt to move configuration from /etc/rscds to /etc/davical --- debian/rscds.postinst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/debian/rscds.postinst b/debian/rscds.postinst index a2224598..66fc27aa 100644 --- a/debian/rscds.postinst +++ b/debian/rscds.postinst @@ -6,6 +6,18 @@ set -e PACKAGE=::package:: [ -n "${DEBUG}" ] && echo "PostInst Parameters: $@" +# +# Migrate directory location to /etc/davical from /etc/rscds +# +if [ -d /etc/rscds -a -d /etc/davical ]; then + for CNFFILE in /etc/rscds/*; do + if [ -f "${CNFFILE}" ]; then + mv "${CNFFILE}" /etc/davical + fi + done + rmdir /etc/rscds + ln -s /etc/davical /etc/rscds +fi case $1 in configure) From 40e87368980b80d6b738c90e286bd21219a1acbb Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 9 Feb 2008 22:52:11 +1300 Subject: [PATCH 64/65] Remove some irrelevant docs. --- debian/rscds.docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rscds.docs b/debian/rscds.docs index d3ef87ed..da99e092 100644 --- a/debian/rscds.docs +++ b/debian/rscds.docs @@ -1,6 +1,6 @@ README TODO INSTALL +CREDITS docs/website/ docs/api/ -testing/README.regression_tests From 73255d1ea5ae1182ebb7657e6aff48c260cce055 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 9 Feb 2008 22:53:09 +1300 Subject: [PATCH 65/65] Updating various credits, copyrights etc. --- CREDITS | 9 +++++++-- debian/README.debian | 10 +++++----- debian/changelog | 3 ++- debian/copyright | 6 +----- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CREDITS b/CREDITS index c070a844..d8d9bb67 100644 --- a/CREDITS +++ b/CREDITS @@ -1,10 +1,10 @@ -The Really Simple CalDAV Store is the brainchild of -Andrew McMillan. +The DAViCal CalDAV Server is the brainchild of Andrew McMillan. Other people have contributed code and/or criticism to help the project along it's way: Maxime Delorme (LDAP, bugfixes, styles) + Andrew Ruthven (a useful touchstone) And a big thank you to the translators: @@ -14,3 +14,8 @@ And a big thank you to the translators: Nick Khazov Eelco Maljaars Rafał Ślubowski + + +Many other people have contributed bug reports, fixes and +in many small ways. These are acknowledged in the changelog +and version control history. diff --git a/debian/README.debian b/debian/README.debian index 52796f43..45871530 100644 --- a/debian/README.debian +++ b/debian/README.debian @@ -1,10 +1,10 @@ -RSCDS for Debian +DAViCal for Debian ---------------- -This is a Really Simple CalDAV Store which I wrote because I -was getting sick of the length of time it was taking to make -worthwhile CalDAV server-side implementations that worked OK -with Evolution. +This is a CalDAV Server which I wrote because I was getting +sick of the length of time it was taking to make worthwhile +CalDAV server-side implementations that worked OK with +Evolution. Then, when I finally did find a CalDAV store that worked, I found that it was quite bloated because it wanted to do vast diff --git a/debian/changelog b/debian/changelog index c00bf84f..495ea9e0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,8 +9,9 @@ rscds (0.9.4) unstable; urgency=low * Create users for the database for DBA and application use during installation. * Work around differences in authentication when PHP is used with FastCGI + * Fixes to CONFIDENTIAL event handling. - -- Andrew McMillan Sat, 26 Jan 2008 16:24:15 +1300 + -- Andrew McMillan Sat, 09 Feb 2008 22:44:42 +1300 rscds (0.9.3) unstable; urgency=low diff --git a/debian/copyright b/debian/copyright index e1da9602..2a951092 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,8 +1,4 @@ The Really Simple CalDAV Store is copyright 2006 Andrew McMillan and are licensed under the Gnu Public License version 2, or later. -Translations are copyright by their authors: - Lorena Paoletti - Cristina Radalescu - Guillaume Rosquin - Nick Khazov +Translations and other contributions are copyright by their authors.