Merge branch 'master' into multiple-email

This commit is contained in:
Andrew Ruthven 2021-03-02 00:41:47 +13:00
commit 2d477ec7fe
5 changed files with 28 additions and 179 deletions

View File

@ -46,6 +46,11 @@ $request = new CalDAVRequest(array("allow_by_email" => 1));
$path_match = '^'.$request->path;
if ( preg_match( '{^/(\S+@[a-z0-9][a-z0-9-]*[.][a-z0-9.-]+)/?$}i', $request->path, $matches ) ) {
$principal = new Principal('email',$matches[1]);
if ( !$principal->Exists() ) {
$request->DoResponse( 404, translate('No user found matching') . ' ' . $matches[1] . "\n" );
}
$path_match = '^'.$principal->dav_name();
}

View File

@ -1,179 +1,2 @@
<?xml version="1.0" encoding="utf-8" ?>
<multistatus xmlns="DAV:" xmlns:VC="urn:ietf:params:xml:ns:carddav">
<response>
<href>/caldav.php/user1/addressbook/andrew_mcmillan.vcf</href>
<propstat>
<prop>
<getetag>some valid etag</getetag>
<VC:address-data>BEGIN:VCARD
VERSION:3.0
TEL;X-EVOLUTION-UI-SLOT=3;TYPE=CELL:+64 22 123 4567
TEL;X-EVOLUTION-UI-SLOT=2;TYPE=HOME,VOICE:+64 4 123 4567
TEL;X-EVOLUTION-UI-SLOT=1;TYPE=WORK,VOICE:+64 22 123 4567
FN:Andrew Watson McMillan
END:VCARD
</VC:address-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/addressbook/donald_kelly.vcf</href>
<propstat>
<prop>
<getetag>some valid etag</getetag>
<VC:address-data>BEGIN:VCARD
FN:Donald Kelly
TEL;TYPE=work:+64 4 347 4747
TEL;TYPE=cell:+64 2 1234-4321
VERSION:2.1
END:VCARD
</VC:address-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/addressbook/F06EC844-EACD-4ADF-8823-588603991E04-ABSPlugin.vcf</href>
<propstat>
<prop>
<getetag>some valid etag</getetag>
<VC:address-data>BEGIN:VCARD
VERSION:3.0
FN:Morphoss Ltd
TEL;TYPE=WORK;TYPE=pref:+64272332426
END:VCARD
</VC:address-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/addressbook/van_houtte.vcf</href>
<propstat>
<prop>
<getetag>some valid etag</getetag>
<VC:address-data>BEGIN:VCARD
VERSION:3.0
FN:Vincent VAN HOUTTE
TEL;TYPE=CELL,VOICE:0486 11 22 33
TEL;TYPE=HOME,VOICE:052 11 22 33
TEL;TYPE=HOME,FAX:052 44 55 66
TEL;TYPE=WORK,VOICE:052 11 22 33
TEL;TYPE=WORK,FAX:052 44 55 66
END:VCARD
</VC:address-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/addressbook/mustrmahn.vcf</href>
<propstat>
<prop>
<getetag>some valid etag</getetag>
<VC:address-data>BEGIN:VCARD
VERSION:3.0
FN:Überwerbung GmbH
TEL;TYPE=WORK;TYPE=pref:+49 30 1234567
TEL;TYPE=CELL:+49 172 1234567
END:VCARD
</VC:address-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/addressbook/andresenesq.vcf</href>
<propstat>
<prop>
<getetag>some valid etag</getetag>
<VC:address-data>BEGIN:VCARD
VERSION:4.0
FN:Sven Joseph Klaus Michael Andresen\, Esq.
TEL;TYPE=WORK,VOICE:+49 89 11 11 111
TEL;TYPE=WORK,VOICE:+49 234 222 222
TEL;TYPE=WORK,FAX:+49 7373 73
TEL;TYPE=PAGER:+49 160 073 727 272
TEL;TYPE=PAGER:+49 2626 26
TEL;TYPE=CELL,VOICE:+49 39292 82
TEL;TYPE=CELL,VOICE:+49 7272 722
TEL;TYPE=PREF,VOICE:+49 12 34 567
TEL;TYPE=CAR,VOICE:+49 8292 38 383
TEL;TYPE=HOME,VOICE:+49 7327 272 727
TEL;TYPE=HOME,VOICE:+49 7272 7282
TEL;TYPE=HOME,FAX:+49 1010 1
TEL;TYPE=ISDN:8797
TEL;TYPE=ISDN:98732947234
TEL;TYPE=X-EVOLUTION-RADIO:+49 88 298 723 498 32
TEL;TYPE=X-EVOLUTION-RADIO:+49 9872 394 872 34
TEL;TYPE=X-EVOLUTION-TELEX:+49 2763 382 882 28 82
TEL;TYPE=X-EVOLUTION-TELEX:+49 7722 88 28 282
TEL;TYPE=MAIN:+49 6237 623 723 84 76
TEL;TYPE=MAIN:+49 9324 32 479 234234
TEL;X-EVOLUTION-CALLBACK:+49 8383 73 723
TEL;X-EVOLUTION-CALLBACK:+49 7363 6363
TEL;TYPE=MODEM:+49 8383 73 723
TEL;TYPE=MODEM:+49 7363 6363
TEL;X-EVOLUTION-TTYTDD:+49 3377 37 373
TEL;X-EVOLUTION-TTYTDD:+49 8378 33
TEL;X-QUICKDIAL:13355
END:VCARD
</VC:address-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/addressbook/hans_dieter.vcf</href>
<propstat>
<prop>
<getetag>some valid etag</getetag>
<VC:address-data>BEGIN:VCARD
VERSION:4.0
FN:Hans Dieter Schmidt
TEL;TYPE=WORK,VOICE:+49 9823 9084
TEL;TYPE=WORK,VOICE:+49 234 234 234
TEL;TYPE=WORK,FAX:+49 7373 73
TEL;TYPE=PAGER:+49 2626 26
TEL;TYPE=CELL,VOICE:+49 7272 722
TEL;TYPE=PREF,VOICE:+49 12 34 567
TEL;TYPE=CAR,VOICE:+49 8292 38 383
TEL;TYPE=HOME,VOICE:+49 7327 272 727
TEL;TYPE=HOME,FAX:+49 40 812 387 21
TEL;TYPE=ISDN:4234234235
TEL;TYPE=ISDN:98732947234
TEL;TYPE=X-EVOLUTION-RADIO:+49 9872 349 832
TEL;TYPE=X-EVOLUTION-RADIO:+49 9872 394 872 34
TEL;TYPE=X-EVOLUTION-TELEX:+49 38 288 228 82
TEL;TYPE=X-EVOLUTION-TELEX:+49 7722 88 28 282
TEL;TYPE=MAIN:+49 6237 623 723 84 76
TEL;TYPE=MAIN:+49 9324 32 479 234234
TEL;X-EVOLUTION-CALLBACK:+49 8383 73 723
TEL;TYPE=MODEM:+49 8383 73 723
TEL;X-EVOLUTION-TTYTDD:+49 7373 73
TEL;X-EVOLUTION-TTYTDD:+49 8378 33
END:VCARD
</VC:address-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/addressbook/J%C3%B6rg_Test-Ro%C3%9Fdeutscher_3_0.vcf</href>
<propstat>
<prop>
<getetag>some valid etag</getetag>
<VC:address-data>BEGIN:VCARD
VERSION:3.0
FN:Jörg Test-Roßdeutscher
TEL;TYPE=WORK;TYPE=pref:040 999999432571-43
TEL;TYPE=CELL:017799999978200
TEL;TYPE=HOME:040999999793017
END:VCARD
</VC:address-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>
<multistatus xmlns="DAV:"/>

View File

@ -3,9 +3,18 @@
#
# param-filter should filter on parameter value. With a negated
# null value we should return all vCards with the property that
# matches the prop-filter type, and there there is a parameter
# matches the prop-filter type, and where there is a parameter
# of TYPE set.
#
# NOTE: This test does not do what one would think it does!
# Testing if a parameter is-defined (is not NULL) is the default case
# and can be achieved with just an empty param-filter, like
# <C:param-filter name="TYPE"/>
# However searching for an empty string within another string (as
# opposed to testing whether they are equal) should always succeed, and
# negating that will always fail, hence this test should return no
# results.
#
TYPE=REPORT
URL=http://regression.host/caldav.php/user1/addressbook/

View File

@ -0,0 +1,6 @@
HTTP/1.1 404 Not Found
Date: Dow, 01 Jan 2000 00:00:00 GMT
Content-Length: 60
Content-Type: text/plain; charset="utf-8"
No user found matching user1@non-existant-email-address.com

View File

@ -0,0 +1,6 @@
#
# Request a freebusy report by URL for an invalid email address
#
TYPE=GET
URL=http://regression.host/freebusy.php/user1@non-existant-email-address.com
HEAD