Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. I want to allow a user with username "smith123" to have read, write access to resource http://localhost:8080/rest/webacl_box1.

    Expand
    Using the two "files" below to create our Authorization and ACL resources.

    Create this file to use as the ACL:

    Code Block
    titlelanguageAcl.ttl
    @prefix webac: <http://fedora.info/definitions/v4/webac#> .
    <> a webac:Acl .
    
    text
    titleacl
    Code Block
    titleAuthorization.ttl
    @prefix acl: <http://www.w3.org/ns/auth/acl#> .
    <><#authz> a acl:Authorization ;
       acl:agent <http://example.org/agent/smith123> ;
       acl:mode acl:Read, acl:Write ;
       acl:accessTo <http://localhost:8080/rest/webacl_box1> .

    We would execute Run the following commands.:

    Code Block
    languagebash
    > curl -X POST -H "Content-type: text/turtle" --data-binary "@Acl.ttl" "XPUT http://localhost:8080/rest"
    
    /webac1_box1
    curl -XPUT http://localhost:8080/rest/acl
    
    > curl -X PUT -H "Content-typewebacl_box1/fcr:acl -H 'Content-Type: text/turtle"' --data-binary "@Authorization@acl.ttl" "http://localhost:8080/rest/acl/auth1"
    
    http://localhost:8080/rest/acl/auth1
    
    > echo "PREFIX acl: <http://www.w3.org/ns/auth/acl#>
    INSERT DATA {
    <> acl:accessControl <http://localhost:8080/rest/acl> .
    }" | curl -X PATCH -H "Content-type: application/sparql-update" --upload-file - "http://localhost:8080/rest/webacl_box1"



  2. I want to let the group "Editors" have read, write access on all the items in the collection "http://localhost:8080/rest/box/bag/collection"

    Expand

    Create this file to use as the ACL:

    Code Block
    languagetext
    titleacl

    Using the two "files" below to create our Authorization and ACL resources.

     

    Code Block
    titleAcl.ttl
    @prefix webac: <http://fedora.info/definitions/v4/webac#> .
    <> a webac:Acl .
    Code Block
    titleAuthorization.ttl
    @prefix acl: <http://www.w3.org/ns/auth/acl#> .
    <> a acl:Authorization ;
       acl:agent <http:///example.org/grouplocalhost:8080/rest/groups/Editors> ;
       acl:mode acl:Read, acl:Write ;
       acl:accessTo <http://localhost:8080/rest/box/bag/collection> .

    We would execute the following commands.

    Create this file to define the Editors group:

    Code Block
    languagetext
    titlegroup.ttl
    @prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
    <> a vcard:Group ;
        vcard:hasMember <http://example.org/agent/jones456>

    Run the following commands:

    Code Block
    languagebash
    curl -XPUT 
    Code Block
    > curl -X POST -H "Content-type: text/turtle" --data-binary "@Acl.ttl" "http://localhost:8080/rest"
    
    /box/bag/collection
    curl -XPUT http://localhost:8080/rest/acl
    
    > curlgroups/Editors -X PUT -H "'Content-typeType: text/turtle"' --data-binary "@Authorization@group.ttl"
    curl -XPUT "http://localhost:8080/rest/acl/auth1"
    
    http://localhost:8080/rest/acl/auth1
    
    > echo "PREFIX acl: <http://www.w3.org/ns/auth/acl#>
    INSERT DATA {
    <> acl:accessControl <http://localhost:8080/rest/acl> .
    }" | curl -X PATCH -H "Content-type: application/sparql-update" --upload-file - "http://localhost:8080/rest/box/bag/collection"box/bag/collection/fcr:acl -H 'Content-Type: text/turtle' --data-binary @acl.ttl



  3.  I would like the collection http://localhost:8080/rest/dark/archive to be viewable only by the groupId group "Restricted", but I would like to allow anyone to view the resource http://localhost:8080/rest/dark/archive/sunshine.

    Expand

    Using the three "files" below to create our Authorization and ACL resources.Create these file to use as the ACLs and the group listing:

    code
    Code Block
    titleAcl.ttl
    @prefix webac: <http://fedora.info/definitions/v4/webac#> .
    <> a webac:Acl .
    languagetext
    titleAuthacl_restricted.ttl
    @prefix acl: <http://www.w3.org/ns/auth/acl#> .
    <> a acl:Authorization ;
       acl:agent <http://example.org/grouplocalhost:8080/rest/groups/Restricted> ;
       acl:mode acl:Read ;
       acl:accessTo <http://localhost:8080/rest/dark/archive> .


    Code Block
    languagetext
    titleAuthacl_open.ttl
    @prefix acl: <http://www.w3.org/ns/auth/acl#> .
    @prefix foaf: <http://xmlns.com/foaf/0.1/> .
    <> a acl:Authorization ;
       acl:agent foaf:Agent ;
       acl:mode acl:Read ;
       acl:accessTo <http://localhost:8080/rest/dark/archive/sunshine> .

    The I would execute the following commands.


    Code Block
    languagetext
    titlegroup.ttl
    @prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
    <> a vcard:Group ;
        vcard:hasMember <http://example.org/agent/jones456>

    Run the following commands:

    Code Block
    curl -XPUT 
    Code Block
    > curl -X POST -H "Content-type: text/turtle" --data-binary "@Acl.ttl" "http://localhost:8080/rest"
    
    http://localhost:8080/rest/acl_lock
    
    > curl -X PUT -H "Content-type: text/turtle" --data-binary "@Auth_restricted.ttl" "http://localhost:8080/rest/acl_lock/auth1"
    
    http://localhost:8080/rest/acl_lockdark/auth1archive
    
    >curl echo "PREFIX acl: <http://www.w3.org/ns/auth/acl#>
    INSERT DATA {
    <> acl:accessControl <http://-XPUT http://localhost:8080/rest/acl_lock> .
    }" | curl -X PATCH -H "Content-type: application/sparql-update" --upload-file - "dark/archive/sunshine
    curl -XPUT http://localhost:8080/rest/dark/archive"
    
    > curl -X POST -H "Content-typegroups/Restricted -H 'Content-Type: text/turtle"' --data-binary "@Acl@group.ttl"
    curl -XPUT "http://localhost:8080/rest"
    
    http://localhost:8080/rest/acl_open
    
    > curl -X PUT dark/archive -H "'Content-typeType: text/turtle"' --data-binary "@Auth@acl_openrestricted.ttl"
    curl -XPUT "http://localhost:8080/rest/acl_open/auth2"
    
    http://localhost:8080/rest/acl_open/auth2
    
    > echo "PREFIX acl: <http://www.w3.org/ns/auth/acl#>
    INSERT DATA {
    <> acl:accessControl <http://localhost:8080/rest/acl_open> .
    }" | curl -X PATCH -H "Content-type: application/sparql-update" --upload-file - "http://localhost:8080/rest/dark/archive/sunshine"dark/archive/sunshine -H 'Content-Type: text/turtle' --data-binary @acl_open.ttl



  4. The collection http://localhost:8080/rest/public_collection should be readable by anyone but only editable by users in the group Editors.

    Expand

    Using the three "files" below to create our Authorization and ACL resources.

    Code Block
    titleAcl.ttl
    @prefix webac: <http://fedora.info/definitions/v4/webac#> .
    <> a webac:Acl .


    Code Block
    titleAuth1.ttl
    @prefix acl: <http://www.w3.org/ns/auth/acl#> .
    @prefix foaf: <http://xmlns.com/foaf/0.1/> .
    <> a acl:Authorization ;
       acl:agent foaf:Agent ;
       acl:mode acl:Read ;
       acl:accessTo <http://localhost:8080/rest/public_collection> .


    Code Block
    titleAuth2.ttl
    @prefix acl: <http://www.w3.org/ns/auth/acl#> .
    <> a acl:Authorization ;
       acl:agent <http://example.org/group/Editors> ;
       acl:mode acl:Read, acl:Write ;
       acl:accessTo <http://localhost:8080/rest/public_collection> .

    I would execute the following code:

    Code Block
    > curl -X POST -H "Content-type: text/turtle" --data-binary "@Acl.ttl" "http://localhost:8080/rest"
    
    http://localhost:8080/rest/acl
    
    > curl -X PUT -H "Content-type: text/turtle" --data-binary "@Auth1.ttl" "http://localhost:8080/rest/acl/auth1"
    
    http://localhost:8080/rest/acl/auth1
    
    > curl -X PUT -H "Content-type: text/turtle" --data-binary "@Auth2.ttl" "http://localhost:8080/rest/acl/auth2"
    
    http://localhost:8080/rest/acl/auth2
    
    > echo "PREFIX acl: <http://www.w3.org/ns/auth/acl#>
    INSERT DATA {
    <> acl:accessControl <http://localhost:8080/rest/acl> .
    }" | curl -X PATCH -H "Content-type: application/sparql-update" --upload-file - "http://localhost:8080/rest/public_collection"



  5. Only the ex:publicImage type objects in the container http://localhost:8080/rest/mixedCollection are viewable by anyone, all others are only viewable by the group Admins.

    Expand

    Using the three "files" below to create our Authorization and ACL resources.

    Code Block
    titleAcl.ttl
    @prefix webac: <http://fedora.info/definitions/v4/webac#> .
    <> a webac:Acl .


    Code Block
    titleAuth_restricted.ttl
    @prefix acl: <http://www.w3.org/ns/auth/acl#> .
    <> a acl:Authorization ;
       acl:agent <http://example.org/group/Admins> ;
       acl:mode acl:Read ;
       acl:accessTo <http://localhost:8080/rest/mixedCollection> .


    Code Block
    titleAuth_open.ttl
    @prefix acl: <http://www.w3.org/ns/auth/acl#> .
    @prefix foaf: <http://xmlns.com/foaf/0.1/> .
    <> a acl:Authorization ;
       acl:agent foaf:Agent ;
       acl:mode acl:Read ;
       acl:accessToClass ex:publicImage .

    I would execute the following commands:

    Code Block
    > curl -X POST -H "Content-type: text/turtle" --data-binary "@Acl.ttl" "http://localhost:8080/rest"
    
    http://localhost:8080/rest/acl
    
    > curl -X PUT -H "Content-type: text/turtle" --data-binary "@Auth_restricted.ttl" "http://localhost:8080/rest/acl/auth1"
    
    http://localhost:8080/rest/acl/auth1
    
    > curl -X PUT -H "Content-type: text/turtle" --data-binary "@Auth_open.ttl" "http://localhost:8080/rest/acl/auth2"
    
    http://localhost:8080/rest/acl/auth2
    
    > echo "PREFIX acl: <http://www.w3.org/ns/auth/acl#>
    INSERT DATA {
    <> acl:accessControl <http://localhost:8080/rest/acl> .
    }" | curl -X PATCH -H "Content-type: application/sparql-update" --upload-file - "http://localhost:8080/rest/mixedCollection"



...