Project

ddr-models

0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Models used in the Duke Digital Repository
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

ddr-models

A Rails engine providing Hydra and ActiveRecord models and common services for the Duke Digital Repository.

Gem Version Build Status Coverage Status Code Climate

Installation

Add to your application's Gemfile:

gem 'ddr-models'

and

bundle install

Configuration

ddr-models has several runtime dependencies that are independently configurable:

ddr-models configuration options:

  • Authentication/Authorization options are set on Ddr::Auth.

Additional configuration steps

User model

Include Ddr::Auth::User in app/models/user.rb and remove content inserted by Hydra and Devise generators:

class User
  include Ddr::Auth::User
  #
  # REMOVE:
  # include Hydra::User
  # devise :database_authenticatable [...]
  #
  # DO NOT REMOVE:
  # Blacklight::User
end

Ability class

The hydra-head generator may have created a class module at app/models/ability.rb like so:

class Ability
  include Hydra::Ability
end

Change the class like so:

class Ability < Ddr::Auth::Ability
  #
  # REMOVE:
  # include Hydra::Ability
  #
  # Add "ability definitions" -- i.e., subclasses of Ddr::Auth::AbilityDefinitions.
  #
  # self.ability_definitions += [ ... ]
  #
end

Controller

Ddr::Auth::RoleBasedAccessControlsEnforcement overrides current_ability, gated_discovery_filters and enforce_show_permissions, so most likely it should be included in ApplicationController.

class ApplicationController < ActionController::Base

  include Ddr::Auth::RoleBasedAccessControlsEnforcement

end

SolrDocument model

Include Ddr::Models::SolrDocument in app/models/solr_document.rb

class SolrDocument

  include Blacklight::Solr::Document
  include Ddr::Models::SolrDocument

...

end

Auxiliary Web Services

In order to use the auxiliary web services, set the DDR_AUX_API_URL environment variable. You may wish to install the ddr-aux app locally and run it.

Migrations

Install the ddr-models migrations:

rake ddr_models:install:migrations

then

rake db:migrate db:test:prepare