dwhipple99 / caldav4j

Automatically exported from code.google.com/p/caldav4j
0 stars 0 forks source link

How to use caldav4j to control access right ? #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What I want is:
have a calendar, and enable the owner to grant access right (read-
only/read-write) to specified user, does caldav4j have such capacity in 
this moment ? 

Original issue reported on code.google.com by yinyuanq...@gmail.com on 17 Aug 2009 at 4:44

GoogleCodeExporter commented 8 years ago
There's something experimental in trunk.. it's a wrapper around slide webdav
functionalities.

Check the 
http://code.google.com/p/caldav4j/source/browse/trunk/src/test/java/org/osaf/cal
dav4j/methods/PropFindTest.java

for the "donttestGetAcl*" methods.. if you want to help with ACL support pls 
write on
caldav4j list and I can help...

afaik with webdav you need always to send the whole ACI - so you need
1- to retrieve old ACI
2- modify ACI
3- send new ACI to caldav server

let me know+Peace,
R.

Original comment by robipo...@gmail.com on 17 Aug 2009 at 2:46

GoogleCodeExporter commented 8 years ago
Hi,
I run the PropFindTest.java on my PC, the server is bedework at localhost:8080, 
but 
what result looks pretty strange, I added some codes in getACL method to 
extract the 
text of entire request :
<----Request----->
Authorization=Basic dmJlZGU6YmVkZXdvcms=
Content-Type=text/xml; charset=utf-8
User-Agent=Jakarta Commons-HttpClient/3.1
Host=localhost:8080
Depth=0
<?xml version="1.0"?>
<D:propfind xmlns:D="DAV:">
    <D:prop>
        <D:acl/>
        <D:owner/>
        <D:supported-privilege-set/>
        <D:current-user-privilege-set/>
    </D:prop>
</D:propfind>

And I got response which is not the resource I want, as see, I request (Or I 
think 
I'm requesting ACL/Owner/privilege-sets from the path)
Here's the response:
<------Response--------->
<?xml version="1.0" encoding="UTF-8"?><multistatus xmlns="DAV:" 
xmlns:ns1="urn:ietf:params:xml:ns:caldav" 
xmlns:ns2="http://www.w3.org/2002/12/cal/ical#">
  <response>
    <href>/ucaldav/user/vbede/collection/</href>
    <propstat>
      <prop>
        <getcontentlength>0</getcontentlength>
        <getlastmodified>Wednesday, 19 Auguest 2009 03:09:18 +0000</getlastmodified>
        <displayname>collection</displayname>
        <getetag>"20090819T030918Z-1"</getetag>
        <current-user-principal>
          <href>/ucaldav/principals/users/vbede</href>
        </current-user-principal>
        <resourcetype>
          <collection/>
          <ns1:calendar/>
        </resourcetype>
      </prop>
      <status>HTTP/1.1 200 ok</status>
    </propstat>
  </response>
</multistatus>

Would pls help to let me know what's wrong ?

Original comment by yinyuanq...@gmail.com on 19 Aug 2009 at 7:27

GoogleCodeExporter commented 8 years ago
More info. based on comment2 ..
That is, in the request text I don't see the path I'm requesting ACL for, isn't 
the 
path should be included in the request header ? Although the path can't been 
seen, 
from tomcat's log I can see the request do include a URI path, maybe it's just 
because I don't know how to extract the path from the PropFindMethod ...

Original comment by yinyuanq...@gmail.com on 19 Aug 2009 at 7:32

GoogleCodeExporter commented 8 years ago
Hi,
I find the problem maybe the request DOM, below is the log in tomcat:
Pls note that 'type=propAll', I think something maybe wrong because I suppose 
to 
query ACL and that's what it appears in the request text in Comment2 above

Tomcat log:
     [java] 18:00:19,390 DEBUG [PropFindMethod] PropFindMethod: doMethod
     [java] 18:00:19,390 DEBUG [PropFindMethod] PropFindMethod: depth=0
     [java] 18:00:19,390 DEBUG [PropFindMethod]                 type=propAll <-Note 
this, I'm curious why it's 'propAll' ? it should be specified to 
ACL/Owner/privilege-
sets I'm querying about ... 

     [java] 18:00:19,390 DEBUG [CaldavBWServlet] setStatus(207)
     [java] 18:00:19,390 DEBUG [CaldavBWServlet] getWriter called
     [java] 18:00:19,390 DEBUG [PropFindMethod] uri: /user/vbede/collection
     [java] 18:00:19,390 DEBUG [PropFindMethod] resourceUri: /user/vbede/collect
ion

Original comment by yinyuanq...@gmail.com on 19 Aug 2009 at 10:10

GoogleCodeExporter commented 8 years ago
Hi,
Sorry for the endless comment :-)
And I found one thing too strange ... that the tomcat log shows the http 
request 
content-length = -1 , and I do not see the content-length appears in the http 
request header, is the content length should be auto-included in request header 
???

Original comment by yinyuanq...@gmail.com on 19 Aug 2009 at 11:20

GoogleCodeExporter commented 8 years ago
Hi, I has resolved the error of 0 content-length, it's because the webdav 
library I 
include in the classpath is not for apache httpclient 3.x.

But what's more, I want to know is there an example can show me how to post a 
new 
ACL to caldav server?

Original comment by yinyuanq...@gmail.com on 20 Aug 2009 at 7:13

GoogleCodeExporter commented 8 years ago
ACL /ucaldav/user/g@r.it/calendar

<?xml version="1.0" encoding="utf-8" ?>
<D:acl xmlns:D="DAV:">
 <D:ace>
       <D:principal>
         <D:href>/principals/users/g@r.it</D:href>
       </D:principal>
       <D:grant>
         <D:privilege><D:read/></D:privilege>
         <D:privilege><D:write/></D:privilege>
       </D:grant>
</D:ace>
</D:acl>

further info: http://www.webdav.org/specs/rfc3744.html

Original comment by robipo...@gmail.com on 24 Aug 2009 at 12:58

GoogleCodeExporter commented 8 years ago
Thanks for the update ! I'll test it futher!

Original comment by yinyuanq...@gmail.com on 18 Sep 2009 at 4:30

GoogleCodeExporter commented 8 years ago
I wrote a getAces/setAces based upon slide.

Original comment by robipo...@gmail.com on 24 May 2010 at 12:41