Skip to content

Controllers How to Create a Hydra Controller

ndushay edited this page Apr 6, 2012 · 2 revisions

Controllers – How to Create a HydraHead Controller

This document walks through how to define a custom controller that manipulates Hydra assets.

Depositor/Owner Permissions

Two steps are necessary in order to ensure that your Controller will set the permissions properly on Assets. If you don’t follow these steps, users will be able to create objects but won’t be able to edit them.

(1) include AssetsControllerHelper in any Custom Controllers

This will provide {AssetsControllerHelper#apply_depositor_metadata} method within your Controllers.

  # in your custom Controllers
  include Hydra::AssetsControllerHelper

(2) call apply_depositor_metadata when you create assets

In your controllers, whenever you create an asset, call apply_depositor_metadata to update the rightsMetadata and apply any other metadata about the depositor.

Important: You must make sure that your models support apply_depositor_metadata. See Defining a custom Hydra Model for more information about doing this in your custom models.

More Information

Further questions? Ask the hydra-tech list or join the freenode #projecthydra IRC channel.

Clone this wiki locally