fcrepo-exts / fcrepo-import-export

Apache License 2.0
15 stars 19 forks source link

Implements export of WebACs from Fedora 5.x #125

Closed dbernstein closed 5 years ago

dbernstein commented 5 years ago

Resolves: https://jira.duraspace.org/browse/FCREPO-2980

This feature is covered by an integration test.

To test it manually:

  1. start a 5.1.0-RC-2 instance fedora instance
  2. create a resource resourceA
  3. create an acl and PUT it to resourceA/fcr:acl
  4. perform and export
  5. verify that resourceA.ttl and resourceA/fcr%3Aacl.ttl exist.
whikloj commented 5 years ago

So trying this against an existing test repository

> java -jar target/fcrepo-import-export-0.4.0-SNAPSHOT.jar -b -d ../import-export-dir -l application/n-triples -p ldp:contains -u fedoraAdmin:fedoraAdmin -w config.yaml -m export -r http://localhost:8080/rest
INFO 12:00:49.442 (ArgParser) Saved configuration to: config.yaml
INFO 12:00:49.452 (Exporter) Running exporter...
INFO 12:00:49.452 (Exporter) Attempting to automatically determine the repository root
INFO 12:00:49.648 (RdfWriterHelper) Loading JENA 3.1.1 Patched RDF Output Writers
INFO 12:00:50.524 (Exporter) Exporting rdf: http://localhost:8080/rest
INFO 12:00:50.548 (Exporter) Exported http://localhost:8080/rest to /sw/var/www/fcrepo4/fcrepo-import-export/../import-export-dir/rest.nt
ERROR 12:00:50.613 (Exporter) Resource is not an LDP Container, LDP RDFSource,  or an LDP NonRDFSource: http://localhost:8080/rest/fcr:acl
whikloj commented 5 years ago

So this does not handle the root authorization of the repository which has a form of

> curl -i -ufedoraAdmin:fedoraAdmin http://localhost:8080/rest/fcr:acl
HTTP/1.1 200 OK
Date: Tue, 25 Jun 2019 17:11:03 GMT
Set-Cookie: JSESSIONID=iechrhy24fvqztgr7v5fn2j7;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Mon, 24-Jun-2019 17:11:03 GMT
Content-Type: text/turtle;charset=utf-8
Content-Length: 705
Server: Jetty(9.3.25.v20180904)

@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix webac:  <http://fedora.info/definitions/v4/webac#> .
@prefix acl:  <http://www.w3.org/ns/auth/acl#> .
@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<info:fedora/fcr:acl#authz>
        acl:default     <info:fedora/> ;
        acl:accessTo    <info:fedora/> ;
        acl:mode        acl:Read ;
        acl:agentClass  <http://xmlns.com/foaf/0.1/Agent> ;
        rdfs:comment    "By default, all non-Admin agents (foaf:Agent) only have read access (acl:Read) to the respository" ;
        rdfs:label      "Root Authorization" ;
        rdf:type        acl:Authorization .

<info:fedora/fcr:acl>
        rdf:type  webac:Acl .
dbernstein commented 5 years ago

@whikloj : Yes - That is true for the default root ACL. I believe the problem is on the Fedora side however. If you override the default ACL by PUTting something to /rest/fcr:acl then the error does not occur. I think we should create a JIRA for default ACLs in fcrepo4.