-
Notifications
You must be signed in to change notification settings - Fork 41
Controllers How to Create a Hydra Controller
This document walks through how to define a custom controller that manipulates Hydra assets.
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.
This will provide {AssetsControllerHelper#apply_depositor_metadata} method within your Controllers.
# in your custom Controllers include Hydra::AssetsControllerHelper
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.
Further questions? Ask the hydra-tech list or join the freenode #projecthydra IRC channel.