You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

These curl command will create a small set of test resources that can be used to test various authorization scenarios. The resources and ACLs can be also modified to test other features of the WebAC implementation not covered by this set.

Create collection1, subcollection1, item1, item2, item3

curl -i -X PUT "http://localhost:8080/fcrepo/rest/collection1"
curl -i -X PUT "http://localhost:8080/fcrepo/rest/collection1/subcollection1"
curl -i -X PUT "http://localhost:8080/fcrepo/rest/collection1/item1"
curl -i -X PUT "http://localhost:8080/fcrepo/rest/collection1/subcollection1/item2"
curl -i -X PUT "http://localhost:8080/fcrepo/rest/collection1/subcollection1/item3"

Create ACL1, add auth 1 & 2

curl -i -X PUT "http://localhost:8080/fcrepo/rest/acl1"
curl -i -X PUT "http://localhost:8080/fcrepo/rest/acl1/auth1"
curl -i -X PUT "http://localhost:8080/fcrepo/rest/acl1/auth2"
curl -i -X PATCH -H "Content-Type: application/sparql-update" -d "PREFIX acl: <http://www.w3.org/ns/auth/acl#> INSERT { <> a acl:Authorization; acl:accessTo </fcrepo/rest/collection1>; acl:mode acl:Read, acl:Write; acl:agent 'adminuser' . } WHERE {}" http://localhost:8080/fcrepo/rest/acl1/auth1
curl -i -X PATCH -H "Content-Type: application/sparql-update" -d "PREFIX acl: <http://www.w3.org/ns/auth/acl#> INSERT { <> a acl:Authorization; acl:accessTo </fcrepo/rest/collection1>; acl:mode acl:Read; acl:agent 'testuser' . } WHERE {}" http://localhost:8080/fcrepo/rest/acl1/auth2

Create ACL2, add auth 3 & 4

curl -i -X PUT "http://localhost:8080/fcrepo/rest/acl2"
curl -i -X PUT "http://localhost:8080/fcrepo/rest/acl2/auth3"
curl -i -X PUT "http://localhost:8080/fcrepo/rest/acl2/auth4"
curl -i -X PATCH -H "Content-Type: application/sparql-update" -d "PREFIX acl: <http://www.w3.org/ns/auth/acl#> INSERT { <> a acl:Authorization; acl:accessTo </fcrepo/rest/collection1/item1>; acl:mode acl:Read, acl:Write; acl:agent 'adminuser' . } WHERE {}" http://localhost:8080/fcrepo/rest/acl2/auth3
curl -i -X PATCH -H "Content-Type: application/sparql-update" -d "PREFIX acl: <http://www.w3.org/ns/auth/acl#> INSERT { <> a acl:Authorization; acl:accessTo </fcrepo/rest/collection1/item1>; acl:mode acl:Read; acl:agent 'adminuser' . } WHERE {}" http://localhost:8080/fcrepo/rest/acl2/auth4

Create ACL3, create auth 5

curl -i -X PUT "http://localhost:8080/fcrepo/rest/acl3"
curl -i -X PUT "http://localhost:8080/fcrepo/rest/acl3/auth5"
curl -i -X PATCH -H "Content-Type: application/sparql-update" -d "PREFIX acl: <http://www.w3.org/ns/auth/acl#> INSERT { <> a acl:Authorization; acl:accessTo </fcrepo/rest/collection1/subcollection1/item3>; acl:mode acl:Read; acl:agent 'adminuser' . } WHERE {}" http://localhost:8080/fcrepo/rest/acl3/auth5

Point collection1 to ACL1, item1 to ACL2, and item3 to ACL3

curl -i -X PATCH -H "Content-Type: application/sparql-update" -d "PREFIX acl: <http://www.w3.org/ns/auth/acl#> INSERT { </fcrepo/rest/collection1> acl:accessControl </fcrepo/rest/acl1> . } WHERE {}" http://localhost:8080/fcrepo/rest/acl1
curl -i -X PATCH -H "Content-Type: application/sparql-update" -d "PREFIX acl: <http://www.w3.org/ns/auth/acl#> INSERT { </fcrepo/rest/collection1/item1> acl:accessControl </fcrepo/rest/acl2> . } WHERE {}" http://localhost:8080/fcrepo/rest/acl2
curl -i -X PATCH -H "Content-Type: application/sparql-update" -d "PREFIX acl: <http://www.w3.org/ns/auth/acl#> INSERT { </fcrepo/rest/collection1/subcollection1/item3> acl:accessControl </fcrepo/rest/acl3> . } WHERE {}" http://localhost:8080/fcrepo/rest/acl3

 

 

  • No labels