mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-21 01:54:23 +00:00
PROPPATCH: Setting properties on Principals now working.
This commit is contained in:
parent
fb5cd0403f
commit
84c5fbea22
@ -57,13 +57,13 @@ foreach( $setprops AS $k => $setting ) {
|
|||||||
* Can't set displayname on resources - only collections or principals
|
* Can't set displayname on resources - only collections or principals
|
||||||
*/
|
*/
|
||||||
if ( $request->IsCollection() || $request->IsPrincipal() ) {
|
if ( $request->IsCollection() || $request->IsPrincipal() ) {
|
||||||
if ( $request->IsCollection() ) {
|
if ( $request->IsPrincipal() ) {
|
||||||
$sql .= sprintf( "UPDATE collection SET dav_displayname = %s, modified = current_timestamp WHERE dav_name = %s;",
|
$sql .= sprintf( "UPDATE dav_principal SET fullname = %s, displayname = %s, modified = current_timestamp WHERE user_no = %s;",
|
||||||
qpg($content), qpg($request->path) );
|
qpg($content), qpg($content), $request->user_no );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sql .= sprintf( "UPDATE usr SET fullname = %s, updated = current_timestamp WHERE user_no = %s;",
|
$sql .= sprintf( "UPDATE collection SET dav_displayname = %s, modified = current_timestamp WHERE dav_name = %s;",
|
||||||
qpg($content), $request->user_no );
|
qpg($content), qpg($request->path) );
|
||||||
}
|
}
|
||||||
$success[$tag] = 1;
|
$success[$tag] = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
HTTP/1.1 200 OK
|
||||||
|
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||||
|
DAV: 1, 2, access-control, calendar-access, calendar-schedule, extended-mkcol, calendar-proxy
|
||||||
|
Content-Length: 219
|
||||||
|
Content-Type: text/xml; charset="utf-8"
|
||||||
|
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<multistatus xmlns="DAV:">
|
||||||
|
<response>
|
||||||
|
<href>/caldav.php/user1/</href>
|
||||||
|
<responsedescription>All requested changes were made.</responsedescription>
|
||||||
|
</response>
|
||||||
|
</multistatus>
|
||||||
|
|
||||||
|
displayname: >User Number One PROPPATCH'd in<
|
||||||
|
fullname: >User Number One PROPPATCH'd in<
|
||||||
|
|
||||||
|
changed_by: >10<
|
||||||
|
dav_name: >/user1/<
|
||||||
|
property_name: >http://dotcal.com/principal-properties:country<
|
||||||
|
property_value: >New Zealand<
|
||||||
|
|
||||||
|
changed_by: >10<
|
||||||
|
dav_name: >/user1/<
|
||||||
|
property_name: >http://dotcal.com/principal-properties:countrycode<
|
||||||
|
property_value: >NZ<
|
||||||
|
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
#
|
||||||
|
# Check for support of PROPPATCH method
|
||||||
|
#
|
||||||
|
# An attempt to set an arbitrary property on a principal
|
||||||
|
#
|
||||||
|
TYPE=PROPPATCH
|
||||||
|
URL=http://mycaldav/caldav.php/user1/
|
||||||
|
HEADER=User-agent: SpecTest PROPPATCH
|
||||||
|
HEADER=Content-type: text/xml
|
||||||
|
HEAD
|
||||||
|
|
||||||
|
BEGINDATA
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<propertyupdate xmlns="DAV:" xmlns:DC="http://dotcal.com/principal-properties">
|
||||||
|
<set>
|
||||||
|
<prop>
|
||||||
|
<DC:country>New Zealand</DC:country>
|
||||||
|
<DC:countrycode>NZ</DC:countrycode>
|
||||||
|
<displayname>User Number One PROPPATCH'd in</displayname>
|
||||||
|
</prop>
|
||||||
|
</set>
|
||||||
|
</propertyupdate>
|
||||||
|
ENDDATA
|
||||||
|
|
||||||
|
QUERY
|
||||||
|
SELECT fullname, displayname FROM dav_principal WHERE dav_name = '/user1/';
|
||||||
|
ENDQUERY
|
||||||
|
|
||||||
|
QUERY
|
||||||
|
SELECT dav_name, property_name, property_value, changed_by FROM property WHERE dav_name = '/user1/';
|
||||||
|
ENDQUERY
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
HTTP/1.1 200 OK
|
||||||
|
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||||
|
DAV: 1, 2, access-control, calendar-access, calendar-schedule, extended-mkcol, calendar-proxy
|
||||||
|
Content-Length: 219
|
||||||
|
Content-Type: text/xml; charset="utf-8"
|
||||||
|
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<multistatus xmlns="DAV:">
|
||||||
|
<response>
|
||||||
|
<href>/caldav.php/user1/</href>
|
||||||
|
<responsedescription>All requested changes were made.</responsedescription>
|
||||||
|
</response>
|
||||||
|
</multistatus>
|
||||||
|
|
||||||
|
displayname: >User 1<
|
||||||
|
fullname: >User 1<
|
||||||
|
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
#
|
||||||
|
# Check for support of PROPPATCH method
|
||||||
|
#
|
||||||
|
# An attempt to set an arbitrary property on a principal
|
||||||
|
#
|
||||||
|
TYPE=PROPPATCH
|
||||||
|
URL=http://mycaldav/caldav.php/user1/
|
||||||
|
HEADER=User-agent: SpecTest PROPPATCH
|
||||||
|
HEADER=Content-type: text/xml
|
||||||
|
HEAD
|
||||||
|
|
||||||
|
BEGINDATA
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<propertyupdate xmlns="DAV:" xmlns:DC="http://dotcal.com/principal-properties">
|
||||||
|
<set>
|
||||||
|
<prop>
|
||||||
|
<displayname>User 1</displayname>
|
||||||
|
</prop>
|
||||||
|
</set>
|
||||||
|
<remove>
|
||||||
|
<prop>
|
||||||
|
<DC:country/>
|
||||||
|
<DC:countrycode/>
|
||||||
|
</prop>
|
||||||
|
</remove>
|
||||||
|
</propertyupdate>
|
||||||
|
ENDDATA
|
||||||
|
|
||||||
|
QUERY
|
||||||
|
SELECT fullname, displayname FROM dav_principal WHERE dav_name = '/user1/';
|
||||||
|
ENDQUERY
|
||||||
|
|
||||||
|
QUERY
|
||||||
|
SELECT * FROM property WHERE dav_name = '/user1/';
|
||||||
|
ENDQUERY
|
||||||
Loading…
x
Reference in New Issue
Block a user