You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am looking for a way to do something like isWritable() for a DavResource. I know there is partial support for ACLs, but the logic to determine whether an ACL matches my own principals is non-trivial and I'm not even certain how I'm supposed to fetch my own principals.
The best lead that I have on implementing this myself is to fetch the "D:current-user-privilege-set" property like so:
private static final QName CURRENT_USER_PRIVILEGE_SET = new QName("DAV:", "current-user-privilege-set", "DAV");
// ...
DavResource resource = sardine.list(uri.toString(), 0, ImmutableSet.of(CURRENT_USER_PRIVILEGE_SET)).get(0);
String result = resource.getCustomPropsNS().get(CURRENT_USER_PRIVILEGE_SET);
But result always comes out as whitespace. I think that this is because the "D:current-user-privilege-set" property's value is an element, not text content.
So I guess this property is of type Privilege, which Sardine already has a model for, but isn't entirely obvious how I can get Sardine to parse the XML to give me an instance of Privilege instead of String, for a custom property value.
This discussion was converted from issue #271 on June 15, 2023 19:03.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am looking for a way to do something like
isWritable()
for aDavResource
. I know there is partial support for ACLs, but the logic to determine whether an ACL matches my own principals is non-trivial and I'm not even certain how I'm supposed to fetch my own principals.The best lead that I have on implementing this myself is to fetch the
"D:current-user-privilege-set"
property like so:But
result
always comes out as whitespace. I think that this is because the"D:current-user-privilege-set"
property's value is an element, not text content.Example from the RFC shows what it looks like:
So I guess this property is of type
Privilege
, which Sardine already has a model for, but isn't entirely obvious how I can get Sardine to parse the XML to give me an instance of Privilege instead of String, for a custom property value.Beta Was this translation helpful? Give feedback.
All reactions