【问题标题】:Determine access rights for CalDAV calendars确定 CalDAV 日历的访问权限
【发布时间】:2024-01-19 09:58:01
【问题描述】:

我正在创建一个 PHP 应用程序,它将事件写入 CalDAV 日历(Kolab 组件)。为此,我要求相应用户的日历主页集。之后,我只想使用我有写入权限的日历。我很可能收到了只允许我阅读的共享日历。 那么如何在注册活动并收到错误消息之前确定对日历的访问权限?

提前致谢。

【问题讨论】:

    标签: php calendar access-control caldav kolab


    【解决方案1】:

    要获得 CalDAV(/*DAV) 资源/收集权限,您可以在检索日历列表时查询 {DAV:}current-user-privilege-set 属性。

    这是RFC 3744 (WebDAV ACL) 的一部分。来自 RFC 的示例:

       PROPFIND /papers/ HTTP/1.1
       Host: www.example.com
       Content-type: text/xml; charset="utf-8"
       Content-Length: xxx
       Depth: 0
       Authorization: Digest username="khare",
         realm="users@example.com", nonce="...",
         uri="/papers/", response="...", opaque="..."
    
       <?xml version="1.0" encoding="utf-8" ?>
       <D:propfind xmlns:D="DAV:">
         <D:prop>
           <D:current-user-privilege-set/>
         </D:prop>
       </D:propfind>
    
       HTTP/1.1 207 Multi-Status
       Content-Type: text/xml; charset="utf-8"
       Content-Length: xxx
    
       <?xml version="1.0" encoding="utf-8" ?>
       <D:multistatus xmlns:D="DAV:">
         <D:response>
         <D:href>http://www.example.com/papers/</D:href>
         <D:propstat>
           <D:prop>
             <D:current-user-privilege-set>
               <D:privilege><D:read/></D:privilege>
             </D:current-user-privilege-set>
           </D:prop>
           <D:status>HTTP/1.1 200 OK</D:status>
         </D:propstat>
         </D:response>
       </D:multistatus>
    

    【讨论】:

    • 您好 Helge,这非常很有帮助!非常感谢你让我走上正轨。