Versions Compared

Key

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

Ingest using the file URI scheme

Since Fedora 3.3 it is possible to reference managed and externally-managed content (type "M" and "E") with a file: URI within the digital object for the ingest. In order to enable this functionality the following changes are necessary:

First edit the predefined XACML policy, uncomment the relevant rule in the preinstalled policy file deny-unallowed-file-resolution.xml and adapt the regex to your needs (or write your own policy). Optionally bind the rule to a specific user. Make sure the RuleId is unique.

Panelcode

...


<Rule RuleId="1" Effect="Permit">


  <Condition FunctionId="urn:oasis:names:tc:xacml:1.0:function:regexp-string-match">


    <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">{^}{{[file:/allowed/.*$]}}</AttributeValue>


    <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">

<ResourceAttributeDesignator

      <ResourceAttributeDesignator AttributeId="urn:fedora:names:fedora:2.1:resource:datastream:fileUri"


DataType="http://www.w3.org/2001/XMLSchema#string"/>


    </Apply>


  </Condition>


</Rule>


...

Then create your digital object FOXML and use the file: URI where necessary.

Panelcode

...


  <foxml:datastream CONTROL_GROUP="E" ID="MEDIUM_SIZE" STATE="A" VERSIONABLE="true">


    <foxml:datastreamVersion CREATED="2008-07-02T05:09:42.937Z"

 
        ID="MediumSize.jpg.0" LABEL="Medium-size image" MIMETYPE="image/jpeg">


      <foxml:contentLocation

 REF="file:///path/to/files/image.jpeg" TYPE="URL"/>


    </foxml:datastreamVersion>


  </foxml:datastream>


...
Note
titlefile URI format

The provided file: URIs must not have an authority component or the authority component must be empty. This means that URIs with the file: scheme must either have one slash (no authority component) after the scheme:
file:/data/image.jpeg
or have three or more slashes (an empty authority component) after the scheme:
file:///data/image.jpeg
If you use this form the regex in the policy that matches the "one slash form" will nontheless match because internally Fedora translates all file: URIs into the one slash form.
As a result {^}file:/data/.*$ will match both forms above.

The use of two slashes after the scheme is not allowed and will result in an error because it defines an authority component.

...