Hi, thanks a lot for sardine that I am trying to integrate into my application (nova video player).
I need to check if I can read or write on a specific url and I am trying to use:
boolean canRead = (sardine.getAcl(url).getAces().get(0).getGranted().get(0) == "read");
boolean canWrite = (sardine.getAcl(url).getAces().get(0).getGranted().get(1) == "write");
Unfortunately sardine.getAcl(url).getAces() is always empty and acl.getOwner(), acl.getGroup() are always null.
I used this following simple code (that works with sardine.list(url)):
package org.courville.sardinetest;
import com.github.sardine.*;
import java.io.IOException;
import java.util.List;
public class Main {
public static void main(String[] args) {
// arguments are: user password url
Sardine sardine = SardineFactory.begin();
sardine.setCredentials(args[0], args[1]);
String url = args[2];
DavAcl acl;
try {
acl = sardine.getAcl(url);
System.out.println("fromUri owner=" + acl.getOwner() + ", group=" + acl.getGroup());
List<DavAce> aces = acl.getAces();
boolean canRead = false;
boolean canWrite = false;
if (! aces.isEmpty()) {
canRead = (aces.get(0).getGranted().get(0) == "read");
canWrite = (aces.get(0).getGranted().get(1) == "write");
} else {
System.out.println("fromUri: aces empty for uri=" + url);
}
System.out.println("fromUri: uri=" + url + ", canWrite=" + canWrite + ", canRead=" + canRead);
} catch (IOException e) {
System.out.println("IOException in getAcl");
}
//List<DavResource> resources = sardine.list(httpUri.toString());
}
}
which outputs:
fromUri owner=null, group=null
fromUri: aces empty for uri=https://redacted/file.txt
fromUri: uri=https://redacted/file.txt, canWrite=false, canRead=false
Is this normal or am I doing something wrong?
Thank you in advance for any hints that would help me progress.
P.S.: some related comments can be found here #109
Hi, thanks a lot for sardine that I am trying to integrate into my application (nova video player).
I need to check if I can read or write on a specific url and I am trying to use:
Unfortunately
sardine.getAcl(url).getAces()is always empty andacl.getOwner(),acl.getGroup()are alwaysnull.I used this following simple code (that works with
sardine.list(url)):which outputs:
Is this normal or am I doing something wrong?
Thank you in advance for any hints that would help me progress.
P.S.: some related comments can be found here #109