fcrepo-exts / fcrepo-import-export

Apache License 2.0
15 stars 19 forks source link

Import ACLs #150

Closed mikejritter closed 3 years ago

mikejritter commented 3 years ago

Resolves: https://jira.lyrasis.org/browse/FCREPO-3333

Potentially resolves https://jira.lyrasis.org/browse/FCREPO-2983 as well (see notes)


Notes


Testing

  1. Start a fresh fedora repository, e.g. with the one-click server java -Dfcrepo.properties.management=relaxed -jar fcrepo-webapp-5.1.1-jetty-console.jar
  2. Create a binary in the repository
  3. Create an acl for the binary

    @prefix acl: <http://www.w3.org/ns/auth/acl#>.
    
    <#authz> a acl:Authorization;
       acl:accessTo </rest/foo>;
       acl:agent "testuser";
       acl:mode acl:Read.
  4. Add the acl to the binary: curl -X PUT -H "Content-Type: text/turtle" --data-binary @acl.ttl -u fedoraAdmin:secret3 "http://192.168.99.100:8080/rest/binary/fcr:acl"
  5. Create a bag-config.yml for export
    bag-info.txt:
     Source-Organization: fcrepo-import-export
     Organization-Address: localhost
     External-Description: BagIt Bag
  6. Run the exporter, specifying that acls should be exported
    java -jar target/fcrepo-import-export-0.4.0-SNAPSHOT.jar --mode export --resource http://localhost:8080/rest --dir fcrepo-3333  --binaries --acls --bag-profile beyondtherepository --bag-config bag-config.yml --bag-algorithms sha1 --user fedoraAdmin:secret3
  7. Check the exported bag for the acls
  8. Refresh the fedora repository a. Stop the server b. Clear the data if necessary (e.g. rm the fcrepo4-data created by the one-click or docker-compose down for docker) c. Restart the server
  9. Run the importer
    java -jar target/fcrepo-import-export-0.4.0-SNAPSHOT.jar --mode import --resource http://localhost:8080/rest --dir fcrepo-3333  --binaries --acls --bag-profile beyondtherepository --bag-config bag-config.yml --bag-algorithms sha1 --user fedoraAdmin:secret3
  10. Check that the acl exists for the binary: curl -u fedoraAdmin:secret3 http://192.168.99.100:8080/rest/binary/fcr:acl