Skip to content

Instantly share code, notes, and snippets.

@otuoma
Last active June 5, 2022 19:53
Show Gist options
  • Save otuoma/58bc86681a9ac79b9ca50081278739e8 to your computer and use it in GitHub Desktop.
Save otuoma/58bc86681a9ac79b9ca50081278739e8 to your computer and use it in GitHub Desktop.
DSPACE 6.3 WATERMARKING, SECURITY FEATURES AND OTHERS ...

DSPACE 6.3 WATERMARK AND SECURITY FEATURES

This branch includes modifications to dspace such as

  1. Add a watermark step to the submission step in XMLUI to allow watermarking uploaded PDFs
  2. Add security features such as prevent printing, copy-pasting and other additional features to the PDF bitstreams
  3. Add a PDF viewer to the item-view.xsl page with no options for download, print or presentation mode
  4. Force user to login again (even when they are already logged in) for specified dspace objects defined in local.cfg

The DSpace code, together with the watermark customization for dspace 6.3 is deployed and can be cloned from github using the following command

git clone -b otuoma/add-watermark https://github.com/otuoma/DSpace.git

Files Added

The following new classes have been added. You don't need to change anything in these two files

1. WatermarkStep.java | See here

dspace-api/src/main/java/org/dspace/submit/step/WatermarkStep.java

2. WatermarkStep.java | See here

dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/submission/submit/WatermarkStep.java

3. Two javascript files in [dspace6]/webapps/xmlui/themes/Mirage2/scripts -- bitstream-switch.js and re-auth.js

These files are used for the PDF viewer and re-authentication functions.

YES. The two files can easily be combined into one but ....

Installation Instructions

Begin by cloning the dspace code from the branch otuoma/add-watermark as shown below;

git clone -b otuoma/add-watermark https://github.com/otuoma/DSpace.git

Install all the dspace prerequisite software as shown in the official documentation at Installing DSpace.

Then inside the directory dspace/config, edit the file local.cfg and add the location of the watermark image. Place the image anywhere on the file system as long as you provide the correct path to it using the following setting in local.cfg

watermark.image = ${dspace.dir}/webapps/xmlui/static/images/hyperlink-logo.png

The file dspace/config/item-submission.xml is already updated this the following code

<step id="watermark">
<heading>submit.progressbar.watermark</heading>
<processing-class>org.dspace.submit.step.WatermarkStep</processing-class>
<xmlui-binding>org.dspace.app.xmlui.aspect.submission.submit.WatermarkStep</xmlui-binding>
<workflow-editable>true</workflow-editable>
</step>

and

<step id="watermark"/>

To disable watermarking, comment out the above last bit of code.

Then run the following command to compile the code.

mvn package -Dmirage2.deps.included=false

If you don't need Mirage2 theme, simply run the following command instead.

mvn package

Then move to the compiled code directory

cd dspace/target/dspace-installer

Then run the following command to deploy the code for tomcat consumption.

ant fresh_install

Follow up with the dspace documentation to complete the installation process.

Resource Re-Authentication Settings

Create any dspace object and copy the resource's URI starting with the handle and add it to the list as shown below in local.cfg.

Separate each resource's URL with a space. Any URL pattern added here will force users to re-authenticate.

reauthentication.patterns = handle/123456789/2 handle/123456789/3 handle/123456789/32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment