Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement principal property search for calendar user address set property #14315

Merged
merged 1 commit into from
Mar 21, 2019

Conversation

georgehrke
Copy link
Member

@georgehrke georgehrke commented Feb 20, 2019

fixes #12033

This will extend FreeBusy support for KDE-PIM and Evolution.

Before:

curl -XREPORT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Depth:0" -d '<principal-property-search xmlns="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">     curl -XREPORT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Depth:0" -d '<principal-property-search xmlns="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
  <apply-to-principal-collection-set />
  <property-search>
    <prop>
      <c:calendar-user-address-set />
    </prop>
    <match>foo3@ehrke.email</match>
  </property-search>
  <prop>
    <displayname />
  </prop>
</principal-property-search>' 'http://nextcloud.local/remote.php/dav/calendars/admin/personal'

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"/>%

after:

curl -XREPORT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Depth:0" -d '<principal-property-search xmlns="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
  <apply-to-principal-collection-set />
  <property-search>
    <prop>
      <c:calendar-user-address-set />
    </prop>
    <match>foo3@ehrke.email</match>
  </property-search>
  <prop>
    <displayname />
  </prop>
</principal-property-search>' 'http://nextcloud.local/remote.php/dav/calendars/admin/personal'

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
<d:response>
    <d:href>/remote.php/dav/principals/users/user2/</d:href>
    <d:propstat>
        <d:prop>
            <d:displayname>Umberto</d:displayname>
        </d:prop>
        <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
</d:response>
</d:multistatus>%

@schiessle

@georgehrke georgehrke added the 3. to review Waiting for reviews label Feb 20, 2019
@georgehrke georgehrke added this to the Nextcloud 16 milestone Feb 20, 2019
@schiessle
Copy link
Member

I just tried it with Evolution but I don't see any free/busy information.

There are two requests when I ask Evolution to update the free/busy information:

First request:

Request

image

Response

image

Second request

Request

image

Response

image

That's what I have in the nextcoud.log:

{"reqId":"M2q5qBrYBjtIRLOyxnXw","level":4,"time":"2019-02-21T12:43:50+00:00","remoteAddr":"127.0.0.1","user":"user1","app":"webdav","method":"REPORT","url":"\/server\/remote.php\/dav\/principals\/users\/admin\/","message":{"Exception":"Sabre\\VObject\\InvalidDataException","Message":"The supplied iCalendar datetime value is incorrect: 2019-02-14T23:00:00Z","Code":0,"Trace":[{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/3rdparty\/sabre\/dav\/lib\/CalDAV\/Xml\/Request\/FreeBusyQueryReport.php","line":78,"function":"parseDateTime","class":"Sabre\\VObject\\DateTimeParser","type":"::","args":["2019-02-14T23:00:00Z"]},{"function":"xmlDeserialize","class":"Sabre\\CalDAV\\Xml\\Request\\FreeBusyQueryReport","type":"::","args":[{"elementMap":{"{DAV:}multistatus":"Sabre\\DAV\\Xml\\Response\\MultiStatus","{DAV:}response":"Sabre\\DAV\\Xml\\Element\\Response","{DAV:}propfind":"Sabre\\DAV\\Xml\\Request\\PropFind","{DAV:}propertyupdate":"Sabre\\DAV\\Xml\\Request\\PropPatch","{DAV:}mkcol":"Sabre\\DAV\\Xml\\Request\\MkCol","{DAV:}resourcetype":"Sabre\\DAV\\Xml\\Property\\ResourceType","{DAV:}sync-collection":"Sabre\\DAV\\Xml\\Request\\SyncCollectionReport","{DAV:}group-member-set":"Sabre\\DAV\\Xml\\Property\\Href","{DAV:}acl":"Sabre\\DAVACL\\Xml\\Property\\Acl","{DAV:}acl-principal-prop-set":"Sabre\\DAVACL\\Xml\\Request\\AclPrincipalPropSetReport","{DAV:}expand-property":"Sabre\\DAVACL\\Xml\\Request\\ExpandPropertyReport","{DAV:}principal-property-search":"Sabre\\DAVACL\\Xml\\Request\\PrincipalPropertySearchReport","{DAV:}principal-search-property-set":"Sabre\\DAVACL\\Xml\\Request\\PrincipalSearchPropertySetReport","{DAV:}principal-match":"Sabre\\DAVACL\\Xml\\Request\\PrincipalMatchReport","{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set":"Sabre\\CalDAV\\Xml\\Property\\SupportedCalendarComponentSet","{urn:ietf:params:xml:ns:caldav}calendar-query":"Sabre\\CalDAV\\Xml\\Request\\CalendarQueryReport","{urn:ietf:params:xml:ns:caldav}calendar-multiget":"Sabre\\CalDAV\\Xml\\Request\\CalendarMultiGetReport","{urn:ietf:params:xml:ns:caldav}free-busy-query":"Sabre\\CalDAV\\Xml\\Request\\FreeBusyQueryReport","{urn:ietf:params:xml:ns:caldav}mkcalendar":"Sabre\\CalDAV\\Xml\\Request\\MkCalendar","{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp":"Sabre\\CalDAV\\Xml\\Property\\ScheduleCalendarTransp","{http:\/\/calendarserver.org\/ns\/}source":"Sabre\\DAV\\Xml\\Property\\Href","{http:\/\/owncloud.org\/ns}share":"OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest","{http:\/\/owncloud.org\/ns}invite":"OCA\\DAV\\DAV\\Sharing\\Xml\\Invite","{urn:ietf:params:xml:ns:carddav}addressbook-query":"Sabre\\CardDAV\\Xml\\Request\\AddressBookQueryReport","{urn:ietf:params:xml:ns:carddav}addressbook-multiget":"Sabre\\CardDAV\\Xml\\Request\\AddressBookMultiGetReport","{http:\/\/calendarserver.org\/ns\/}me-card":"Sabre\\DAV\\Xml\\Property\\Href","{http:\/\/owncloud.org\/ns}tags":"OCA\\DAV\\Connector\\Sabre\\TagList","{http:\/\/owncloud.org\/ns}share-types":"OCA\\DAV\\Connector\\Sabre\\ShareTypeList","{http:\/\/nextcloud.com\/ns}calendar-search":"OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport"},"contextUri":"\/server\/remote.php\/dav\/principals\/users\/admin\/","namespaceMap":[],"classMap":[],"__class__":"Sabre\\Xml\\Reader"}]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/3rdparty\/sabre\/xml\/lib\/Reader.php","line":246,"function":"call_user_func","args":[["Sabre\\CalDAV\\Xml\\Request\\FreeBusyQueryReport","xmlDeserialize"],{"elementMap":{"{DAV:}multistatus":"Sabre\\DAV\\Xml\\Response\\MultiStatus","{DAV:}response":"Sabre\\DAV\\Xml\\Element\\Response","{DAV:}propfind":"Sabre\\DAV\\Xml\\Request\\PropFind","{DAV:}propertyupdate":"Sabre\\DAV\\Xml\\Request\\PropPatch","{DAV:}mkcol":"Sabre\\DAV\\Xml\\Request\\MkCol","{DAV:}resourcetype":"Sabre\\DAV\\Xml\\Property\\ResourceType","{DAV:}sync-collection":"Sabre\\DAV\\Xml\\Request\\SyncCollectionReport","{DAV:}group-member-set":"Sabre\\DAV\\Xml\\Property\\Href","{DAV:}acl":"Sabre\\DAVACL\\Xml\\Property\\Acl","{DAV:}acl-principal-prop-set":"Sabre\\DAVACL\\Xml\\Request\\AclPrincipalPropSetReport","{DAV:}expand-property":"Sabre\\DAVACL\\Xml\\Request\\ExpandPropertyReport","{DAV:}principal-property-search":"Sabre\\DAVACL\\Xml\\Request\\PrincipalPropertySearchReport","{DAV:}principal-search-property-set":"Sabre\\DAVACL\\Xml\\Request\\PrincipalSearchPropertySetReport","{DAV:}principal-match":"Sabre\\DAVACL\\Xml\\Request\\PrincipalMatchReport","{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set":"Sabre\\CalDAV\\Xml\\Property\\SupportedCalendarComponentSet","{urn:ietf:params:xml:ns:caldav}calendar-query":"Sabre\\CalDAV\\Xml\\Request\\CalendarQueryReport","{urn:ietf:params:xml:ns:caldav}calendar-multiget":"Sabre\\CalDAV\\Xml\\Request\\CalendarMultiGetReport","{urn:ietf:params:xml:ns:caldav}free-busy-query":"Sabre\\CalDAV\\Xml\\Request\\FreeBusyQueryReport","{urn:ietf:params:xml:ns:caldav}mkcalendar":"Sabre\\CalDAV\\Xml\\Request\\MkCalendar","{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp":"Sabre\\CalDAV\\Xml\\Property\\ScheduleCalendarTransp","{http:\/\/calendarserver.org\/ns\/}source":"Sabre\\DAV\\Xml\\Property\\Href","{http:\/\/owncloud.org\/ns}share":"OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest","{http:\/\/owncloud.org\/ns}invite":"OCA\\DAV\\DAV\\Sharing\\Xml\\Invite","{urn:ietf:params:xml:ns:carddav}addressbook-query":"Sabre\\CardDAV\\Xml\\Request\\AddressBookQueryReport","{urn:ietf:params:xml:ns:carddav}addressbook-multiget":"Sabre\\CardDAV\\Xml\\Request\\AddressBookMultiGetReport","{http:\/\/calendarserver.org\/ns\/}me-card":"Sabre\\DAV\\Xml\\Property\\Href","{http:\/\/owncloud.org\/ns}tags":"OCA\\DAV\\Connector\\Sabre\\TagList","{http:\/\/owncloud.org\/ns}share-types":"OCA\\DAV\\Connector\\Sabre\\ShareTypeList","{http:\/\/nextcloud.com\/ns}calendar-search":"OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport"},"contextUri":"\/server\/remote.php\/dav\/principals\/users\/admin\/","namespaceMap":[],"classMap":[],"__class__":"Sabre\\Xml\\Reader"}]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/3rdparty\/sabre\/xml\/lib\/Reader.php","line":71,"function":"parseCurrentElement","class":"Sabre\\Xml\\Reader","type":"->","args":[]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/3rdparty\/sabre\/xml\/lib\/Service.php","line":118,"function":"parse","class":"Sabre\\Xml\\Reader","type":"->","args":[]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":713,"function":"parse","class":"Sabre\\Xml\\Service","type":"->","args":["<free-busy-query xmlns=\"urn:ietf:params:xml:ns:caldav\">\n  <time-range start=\"2019-02-14T23:00:00Z\" end=\"2019-03-21T23:00:00Z\"\/>\n<\/free-busy-query>","\/server\/remote.php\/dav\/principals\/users\/admin\/",null]},{"function":"httpReport","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"http:\/\/localhost\/server\/remote.php\/dav\/principals\/users\/admin\/","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpReport"],[{"absoluteUrl":"http:\/\/localhost\/server\/remote.php\/dav\/principals\/users\/admin\/","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:REPORT",[{"absoluteUrl":"http:\/\/localhost\/server\/remote.php\/dav\/principals\/users\/admin\/","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"http:\/\/localhost\/server\/remote.php\/dav\/principals\/users\/admin\/","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/apps\/dav\/lib\/Server.php","line":313,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/apps\/dav\/appinfo\/v2\/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"\/home\/schiesbn\/Repos\/nextcloud\/server\/remote.php","line":163,"args":["\/home\/schiesbn\/Repos\/nextcloud\/server\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/home\/schiesbn\/Repos\/nextcloud\/server\/3rdparty\/sabre\/vobject\/lib\/DateTimeParser.php","Line":40,"CustomMessage":"--"},"userAgent":"Evolution\/3.30.5","version":"16.0.0.0"}

@georgehrke
Copy link
Member Author

georgehrke commented Feb 21, 2019

@schiessle Can you please report that as a bug to Evolution?

To be fair, Sabre/DAV is very strict here, but it got every right to do so:
https://tools.ietf.org/html/rfc4791#section-7.10.1

time-range requires a iCalendar formatted date-time string in UTC, see definition https://tools.ietf.org/html/rfc4791#section-9.9

iCalendar is YYYYMMDDTHHMMSSZ, not YYYY-MM-DDTHH:MM:SSZ

2019-02-14T23:00:00Z should be 20190214T230000Z

@schiessle
Copy link
Member

Sure, I will forward it.

@schiessle
Copy link
Member

For reference, this is the Evolution ticket: https://gitlab.gnome.org/GNOME/evolution/issues/316

Copy link
Member

@schiessle schiessle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I can't test it because of a Evolution bug (which is already fixed thanks to the awesome Gnome team, I just wait for the release and that the update lands in Debian). But code looks good, so I'm fine with merging it.

@schiessle
Copy link
Member

maybe a KDE user like @tobiasKaminsky could give it a try with Kontact?

@tobiasKaminsky
Copy link
Member

I can give it a try, though I do not use Kontact.

@tobiasKaminsky
Copy link
Member

Hm. I do not get what I should test…
Can you give me a hint? (also on IRC if you want)

@schiessle
Copy link
Member

@tobiasKaminsky You create two users (user1 and user2). Create calendar entry for user2, connect the calendar of user1 to KDE Kontact. Setup an event/appointment in the calendar at the same date you created already an entry for user2 and add user2 as participant. Kontacts should have a free/busy few where you can see if user2 has time at the date or not, he should be show as busy.

@tobiasKaminsky
Copy link
Member

Either I did something wrong or it is not working:
"Participants: schedule" is greyed out

image

This was referenced Mar 4, 2019
@MorrisJobke MorrisJobke added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Mar 20, 2019
@MorrisJobke
Copy link
Member

@georgehrke 🏓

@georgehrke
Copy link
Member Author

@tobiasKaminsky Can you select a Meeting organiser?

@MorrisJobke Even if KOrganiser doesn't work at the moment, it didn't work before either. As @schiessle confirmed, this adds support for Evolution, so we should get this in now imho.

@georgehrke georgehrke added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Mar 20, 2019
@tobiasKaminsky
Copy link
Member

@tobiasKaminsky Can you select a Meeting organiser?

image

Does not seem that good…
To be honest, I am not 100% if I am doing it right:

  • I switched to your branch
  • added NC via KOganizer
  • create an event

In settings I also see:
image
image
image

@MorrisJobke
Copy link
Member

Moved to 17 - in case it fixes issues we still can backport it.

@georgehrke
Copy link
Member Author

@MorrisJobke I think we should get this in now.
This pull-request does exactly what the related ticket is about: #12033

It implements support for a principal-property-search based on the calendar-user-address-set.
This adds FreeBusy support for Evolution. If KDE PIM requires yet another API to query free-busy data, that should be addressed in a separate PR.

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me then 👍

@MorrisJobke MorrisJobke added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Mar 21, 2019
…perty

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
@MorrisJobke MorrisJobke force-pushed the feature/12033/calendar-user-address-set branch from 455a398 to d74e49b Compare March 21, 2019 15:32
@MorrisJobke
Copy link
Member

Rebased to retrigger CI.

@tobiasKaminsky
Copy link
Member

@georgehrke also fine by me.
You can always ping me if I shall test something.

@MorrisJobke
Copy link
Member

@MorrisJobke MorrisJobke merged commit 973ccd8 into master Mar 21, 2019
@MorrisJobke MorrisJobke deleted the feature/12033/calendar-user-address-set branch March 21, 2019 20:32
@CarliJoy
Copy link

CarliJoy commented Aug 13, 2024

If KDE PIM requires yet another API to query free-busy data, that should be addressed in a separate PR.

Was this PR created? I can't find anythin searching.

The related help entry doesn't get me any further as well.

I am unsure if I should create another issue or rather look into KDE PIM configuration options...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support principal property search for calendar-user-address-set
5 participants