Configuration

From MIDAS Wiki

Jump to: navigation, search

This page describes the different configuration options of the MIDAS system.

Contents

LDAP Configuration

Make sure that ldap is enabled for php

 apt-get install php5-ldap

In order to enable LDAP support, you should set the LDAP configuration in the config.php

 $MIDAS_USE_LDAP= '1';

Then setup the configuration of the LDAP server in the config/config.ldap.php

'hostname' => 'localhost', 
'basedn' => 'ou=people,dc=myorganization,dc=com',
'protocolversion' => '3'

if you are using active directory

'useActiveDirectory' => true,

if your LDAP server doesn't accept anonymous search

 'proxyBasedn' => ,
 'proxyPassword' => ,

Note: MIDAS will match users by email based on the first part of the email ('uid' in the LDAP) and will add their information (first and lastname) in the MIDAS database with their password (this password is used only for recovery but is not used in the login process. Note: If the password is changed in the LDAP, the password will be automatically updated upon login in the MIDAS database (in case non LDAP support is required in the future).

If you need to use 'mail' and match the complete email instead of 'uid'

 'search' => 'mail',

WebDAV configuration

MIDAS 2.6 has added WebDAV support. In order to enable webdav, edit your config.local.php and add/edit the following:

 // Enable Webdav
 $MIDAS_WEBDAV='1';
 // Base URI of the server
 $MIDAS_WEBDAV_BASE_URI='/midasdav/';

For Windows clients you need to make sure that you redirect from the top of the web root otherwise authentication fails.

  • Create a directory midasdav at the root of your webroot
  • In your apache virtual host configuration file add the following lines:
 <Directory C:/xampp/htdocs/midasdav>
   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule  ^$ /MIDASserver/midas/webdav/
   RewriteRule (.*) /MIDASserver/midas/webdav/$1 
  </Directory>

Command Line Upload

MIDAS can import and update data from a local directory using PHP command line (might need php-cli). The script to run is named localupload_command.php and take the following arguments:

1) /localupload/commandline 2) The id of the user uploading the data (usually 1 for administrator) 3) If it's a community or a collection 4) The id of the community of the collection 5) If the item should private upon upload 6) If the item should be update if newer in the directory 7) The local directory on the server 8) The log file

Example: php5 midas/localupload_command.php /localupload/commandline 1 community 2 true true C:/Julien/testmidas uploadlog.txt

Signing bitstreams

MIDAS provides the ability to sign bitstream with a SHA-1 key. This key allows an external application to make sure the bitstream is actually coming from MIDAS. In order to enable the signature you should first create a SHA-1 key using ssh-keygen.

 openssl genrsa /path/to/my/file/midaskey.private.pem
 openssl rsa -in /path/to/my/file/midaskey.private.pme -out midaskey.public.pem -outformP PEM -pubout

Specify the private key in the config.local.php. It's recommended to put the key outside of the http server if your configuration permits it.

 $MIDAS_SHA1_KEY_FILE='pathoutsidetheserver/midaskey.private.pem';

To get the signature from MIDAS:

 http://localhost/midas/bitstream/signature/<bitstreamid>

Adding new type of resources

  1. Create the tables in $ROOT/midas/config/MIDAS.sql and $ROOT/midas/config/MIDAS-UPGRADE-CORE-x.x.x.sql
  2. Create a filter in $ROOT/vendors/filters
  3. Add filter rules in $ROOT/midas/config/config_filters_local.php
  4. Create a view for the resource in $ROOT/midas/view/resource/$NAMEOFTHERESOURCE.thtml
  5. Add a $NAMEOFTHERESOURCE action in $ROOT/midas/controller/resource_controller.php

Configuring filters

Filters are configured in $MIDAS/midas/config/config.filters.local.php If you do not have this file copy config.filters.php into config.filters.local.php and remove everything after the line:

 /** delete everything after this statement ONLY in config.filters.local.php **/

Keep the config.filter.php file untouched.

The total number of filter is unlimited but each one must have a unique name ([a-zA-Z0-9]). The $names variable must contains the list of all the filter in use (the order doesn't matter):

 $names = array('ColorFrequency', 'InfoImage', 'WordFrequency', 'ThumbnailCreator');

The filters are called at different stage during the upload process. You can specify which filter to call and when by adding the filter to following variable:

  • $preFilters: before storing the file in the database
  • $postFilters: after the file is stored in the database
  • $resourceFilters: before creating resources
  • $postResourceFilters: after creating resource

Currently only $resourceFilters is supported.

Adding a filter to one of the 4 stages require:

  • the name of the filter (ie the name used in $names)
  • the regular expression of the files to proceed (include pattern)
  • the regular expression of the files to ignore (exclude pattern)

To be proceeded, a file name must match to the include pattern and must NOT match to the exclude pattern. The regular expression is case-insensitive. Use '^$' instead of an empty string to match no file.

Here is an example of adding a filter to the $resourceFilters stage:

 $resourceFilters = array(
   array(...),
   array('regexpr' => array('include' => '.*\.(jpg|jpeg|tif|tiff|png|bmp)', 'exclude'=>'^$'),
         'name' => 'ColorFrequency')
   )

The calls the filter 'ColorFrequency' on all files with a '.jpg' or '.jpeg' or '.tif' ... extension.

Handle Server

  • Run
 /dspace/bin/dsrun net.handle.server.SimpleSetup /dspace/handle-server 

Follow the instructions, answering relatively simple questions.

Another option might be to run

 /dspace/bin/make-handle-config 

after configuring dspace.cfg.

WARNING: Make sure there is no space in the password or dbname in the dspace.cfg

  • Edit the config.dct
 "server_config" = {
 "storage_type" = "CUSTOM" <-- Add this line
 "storage_class" = "org.dspace.handle.HandlePlugin" <-- Add this line
 "server_admins" = (
 "300:0.NA/10376" <-- Change this to your handle
 )
Personal tools