ddr-models 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +12 -0
  3. data/README.md +5 -0
  4. data/Rakefile +37 -0
  5. data/app/models/attachment.rb +7 -0
  6. data/app/models/collection.rb +54 -0
  7. data/app/models/component.rb +15 -0
  8. data/app/models/item.rb +19 -0
  9. data/app/models/solr_document.rb +36 -0
  10. data/app/models/target.rb +8 -0
  11. data/config/initializers/active_fedora_base.rb +77 -0
  12. data/config/initializers/active_fedora_datastream.rb +5 -0
  13. data/config/initializers/ddr.rb +8 -0
  14. data/config/initializers/devise.rb +245 -0
  15. data/config/initializers/devise.rb~ +245 -0
  16. data/config/initializers/subscriptions.rb +15 -0
  17. data/config/routes.rb +2 -0
  18. data/db/migrate/20141021233359_create_events.rb +28 -0
  19. data/db/migrate/20141021234156_create_minted_ids.rb +19 -0
  20. data/db/migrate/20141103192146_create_workflow_state.rb +13 -0
  21. data/db/migrate/20141104181418_create_users.rb +34 -0
  22. data/db/migrate/20141104181418_create_users.rb~ +6 -0
  23. data/lib/ddr-models.rb +1 -0
  24. data/lib/ddr/actions.rb +8 -0
  25. data/lib/ddr/actions/fixity_check.rb +35 -0
  26. data/lib/ddr/auth.rb +45 -0
  27. data/lib/ddr/auth.rb~ +47 -0
  28. data/lib/ddr/auth/ability.rb +204 -0
  29. data/lib/ddr/auth/ability.rb~ +204 -0
  30. data/lib/ddr/auth/group_service.rb +53 -0
  31. data/lib/ddr/auth/group_service.rb~ +53 -0
  32. data/lib/ddr/auth/grouper_service.rb +76 -0
  33. data/lib/ddr/auth/grouper_service.rb~ +77 -0
  34. data/lib/ddr/auth/remote_group_service.rb +35 -0
  35. data/lib/ddr/auth/remote_group_service.rb~ +35 -0
  36. data/lib/ddr/auth/superuser.rb +13 -0
  37. data/lib/ddr/auth/superuser.rb~ +9 -0
  38. data/lib/ddr/auth/user.rb +71 -0
  39. data/lib/ddr/auth/user.rb~ +65 -0
  40. data/lib/ddr/configurable.rb +34 -0
  41. data/lib/ddr/datastreams.rb +32 -0
  42. data/lib/ddr/datastreams/content_metadata_datastream.rb +147 -0
  43. data/lib/ddr/datastreams/datastream_behavior.rb +95 -0
  44. data/lib/ddr/datastreams/descriptive_metadata_datastream.rb +84 -0
  45. data/lib/ddr/datastreams/properties_datastream.rb +25 -0
  46. data/lib/ddr/datastreams/role_assignments_datastream.rb +19 -0
  47. data/lib/ddr/events.rb +17 -0
  48. data/lib/ddr/events/creation_event.rb +12 -0
  49. data/lib/ddr/events/event.rb +163 -0
  50. data/lib/ddr/events/fixity_check_event.rb +43 -0
  51. data/lib/ddr/events/ingestion_event.rb +12 -0
  52. data/lib/ddr/events/preservation_event_behavior.rb +37 -0
  53. data/lib/ddr/events/preservation_event_type.rb +24 -0
  54. data/lib/ddr/events/reindex_object_after_save.rb +18 -0
  55. data/lib/ddr/events/update_event.rb +9 -0
  56. data/lib/ddr/events/validation_event.rb +11 -0
  57. data/lib/ddr/events/virus_check_event.rb +30 -0
  58. data/lib/ddr/index_fields.rb +39 -0
  59. data/lib/ddr/metadata.rb +22 -0
  60. data/lib/ddr/metadata/duke_terms.rb +15 -0
  61. data/lib/ddr/metadata/premis_event.rb +59 -0
  62. data/lib/ddr/metadata/rdf_vocabulary_parser.rb +45 -0
  63. data/lib/ddr/metadata/roles_vocabulary.rb +10 -0
  64. data/lib/ddr/metadata/sources/duketerms.rdf.xml +856 -0
  65. data/lib/ddr/metadata/vocabulary.rb +37 -0
  66. data/lib/ddr/models.rb +60 -0
  67. data/lib/ddr/models/access_controllable.rb +23 -0
  68. data/lib/ddr/models/base.rb +37 -0
  69. data/lib/ddr/models/describable.rb +81 -0
  70. data/lib/ddr/models/engine.rb +58 -0
  71. data/lib/ddr/models/error.rb +12 -0
  72. data/lib/ddr/models/event_loggable.rb +36 -0
  73. data/lib/ddr/models/file_management.rb +183 -0
  74. data/lib/ddr/models/fixity_checkable.rb +20 -0
  75. data/lib/ddr/models/governable.rb +48 -0
  76. data/lib/ddr/models/has_attachments.rb +12 -0
  77. data/lib/ddr/models/has_children.rb +21 -0
  78. data/lib/ddr/models/has_content.rb +114 -0
  79. data/lib/ddr/models/has_content_metadata.rb +16 -0
  80. data/lib/ddr/models/has_properties.rb +15 -0
  81. data/lib/ddr/models/has_role_assignments.rb +17 -0
  82. data/lib/ddr/models/has_thumbnail.rb +27 -0
  83. data/lib/ddr/models/has_workflow.rb +29 -0
  84. data/lib/ddr/models/indexing.rb +53 -0
  85. data/lib/ddr/models/licensable.rb +28 -0
  86. data/lib/ddr/models/minted_id.rb +10 -0
  87. data/lib/ddr/models/permanent_identification.rb +48 -0
  88. data/lib/ddr/models/solr_document.rb +193 -0
  89. data/lib/ddr/models/version.rb +5 -0
  90. data/lib/ddr/notifications.rb +15 -0
  91. data/lib/ddr/services.rb +8 -0
  92. data/lib/ddr/services/id_service.rb +48 -0
  93. data/lib/ddr/utils.rb +153 -0
  94. data/lib/ddr/workflow.rb +8 -0
  95. data/lib/ddr/workflow/workflow_state.rb +39 -0
  96. data/spec/dummy/README.rdoc +28 -0
  97. data/spec/dummy/Rakefile +6 -0
  98. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  99. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  100. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  101. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  102. data/spec/dummy/app/models/user.rb +5 -0
  103. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  104. data/spec/dummy/bin/bundle +3 -0
  105. data/spec/dummy/bin/rails +4 -0
  106. data/spec/dummy/bin/rake +4 -0
  107. data/spec/dummy/config.ru +4 -0
  108. data/spec/dummy/config/application.rb +29 -0
  109. data/spec/dummy/config/boot.rb +5 -0
  110. data/spec/dummy/config/database.yml +25 -0
  111. data/spec/dummy/config/environment.rb +5 -0
  112. data/spec/dummy/config/environments/development.rb +37 -0
  113. data/spec/dummy/config/environments/production.rb +78 -0
  114. data/spec/dummy/config/environments/test.rb +39 -0
  115. data/spec/dummy/config/initializers/assets.rb +8 -0
  116. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  117. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  118. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  119. data/spec/dummy/config/initializers/inflections.rb +16 -0
  120. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  121. data/spec/dummy/config/initializers/session_store.rb +3 -0
  122. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  123. data/spec/dummy/config/locales/en.yml +23 -0
  124. data/spec/dummy/config/routes.rb +56 -0
  125. data/spec/dummy/config/secrets.yml +22 -0
  126. data/spec/dummy/db/development.sqlite3 +0 -0
  127. data/spec/dummy/db/schema.rb +80 -0
  128. data/spec/dummy/db/test.sqlite3 +0 -0
  129. data/spec/dummy/log/development.log +4974 -0
  130. data/spec/dummy/log/test.log +55627 -0
  131. data/spec/dummy/public/404.html +67 -0
  132. data/spec/dummy/public/422.html +67 -0
  133. data/spec/dummy/public/500.html +66 -0
  134. data/spec/dummy/public/favicon.ico +0 -0
  135. data/spec/factories/attachment_factories.rb +15 -0
  136. data/spec/factories/collection_factories.rb +16 -0
  137. data/spec/factories/component_factories.rb +15 -0
  138. data/spec/factories/event_factories.rb +7 -0
  139. data/spec/factories/item_factories.rb +16 -0
  140. data/spec/factories/target_factories.rb +11 -0
  141. data/spec/factories/test_model_factories.rb +133 -0
  142. data/spec/factories/user_factories.rb +7 -0
  143. data/spec/factories/user_factories.rb~ +7 -0
  144. data/spec/features/grouper_integration_spec.rb~ +21 -0
  145. data/spec/fixtures/contentMetadata.xml +37 -0
  146. data/spec/fixtures/image1.tiff +0 -0
  147. data/spec/fixtures/image2.tiff +0 -0
  148. data/spec/fixtures/image3.tiff +0 -0
  149. data/spec/fixtures/library-devil.tiff +0 -0
  150. data/spec/fixtures/sample.docx +0 -0
  151. data/spec/fixtures/sample.pdf +0 -0
  152. data/spec/fixtures/target.png +0 -0
  153. data/spec/models/ability_spec.rb +248 -0
  154. data/spec/models/ability_spec.rb~ +245 -0
  155. data/spec/models/active_fedora_base_spec.rb +107 -0
  156. data/spec/models/active_fedora_datastream_spec.rb +121 -0
  157. data/spec/models/attachment_spec.rb +13 -0
  158. data/spec/models/collection_spec.rb +33 -0
  159. data/spec/models/component_spec.rb +8 -0
  160. data/spec/models/descriptive_metadata_datastream_spec.rb +102 -0
  161. data/spec/models/events_spec.rb +64 -0
  162. data/spec/models/file_management_spec.rb +179 -0
  163. data/spec/models/has_role_assignments_spec.rb +29 -0
  164. data/spec/models/has_workflow_spec.rb +54 -0
  165. data/spec/models/item_spec.rb +8 -0
  166. data/spec/models/permanent_identification_spec.rb +65 -0
  167. data/spec/models/role_assignments_datastream_spec.rb +25 -0
  168. data/spec/models/superuser_spec.rb +13 -0
  169. data/spec/models/superuser_spec.rb~ +13 -0
  170. data/spec/models/target_spec.rb +8 -0
  171. data/spec/models/user_spec.rb +60 -0
  172. data/spec/models/user_spec.rb~ +56 -0
  173. data/spec/services/group_service_spec.rb +75 -0
  174. data/spec/services/group_service_spec.rb~ +71 -0
  175. data/spec/services/id_service_spec.rb +33 -0
  176. data/spec/spec_helper.rb +125 -0
  177. data/spec/support/shared_examples_for_access_controllables.rb +6 -0
  178. data/spec/support/shared_examples_for_associations.rb +8 -0
  179. data/spec/support/shared_examples_for_ddr_models.rb +7 -0
  180. data/spec/support/shared_examples_for_describables.rb +63 -0
  181. data/spec/support/shared_examples_for_event_loggables.rb +3 -0
  182. data/spec/support/shared_examples_for_events.rb +179 -0
  183. data/spec/support/shared_examples_for_governables.rb +17 -0
  184. data/spec/support/shared_examples_for_has_content.rb +136 -0
  185. data/spec/support/shared_examples_for_has_content_metadata.rb +74 -0
  186. data/spec/support/shared_examples_for_has_properties.rb +5 -0
  187. data/spec/support/shared_examples_for_indexing.rb +36 -0
  188. metadata +562 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ae8bdb54bb6fa40f55f7a5af6ea116cecc9f4905
4
+ data.tar.gz: 6feec1443beefcc7f05d05ed51d5f0f0fdf653aa
5
+ SHA512:
6
+ metadata.gz: 39366ec688860ce4ef4b06e0a38e7f3462e9fb855b06d9eaa747944aa8897dd879b49b6ce7d77f9ef6aa20aaea527c920226a48694189198815e855ee08c9b61
7
+ data.tar.gz: 38282725b45d3461d246a821f14c3d2a39b408749817edb0e89396b5e84d35b5b68eb040d0d0db8f7af9729067cc5edea9b6c781600a203030482b330a8e1a1f
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2014, Duke University
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,5 @@
1
+ # Ddr::Models
2
+
3
+ [![Build Status](https://travis-ci.org/duke-libraries/ddr-models.svg?branch=develop)](https://travis-ci.org/duke-libraries/ddr-models)
4
+
5
+ Hydra models for the Duke Digital Repository.
@@ -0,0 +1,37 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ Bundler::GemHelper.install_tasks
8
+
9
+ APP_ROOT = File.dirname(__FILE__)
10
+
11
+ JETTY_CONFIG = {
12
+ jetty_home: File.join(APP_ROOT, "jetty"),
13
+ jetty_port: 8983,
14
+ startup_wait: 45,
15
+ quiet: true,
16
+ java_opts: ["-Xmx256m", "-XX:MaxPermSize=128m"]
17
+ }
18
+
19
+ require 'rspec/core/rake_task'
20
+ require 'jettywrapper'
21
+
22
+ Jettywrapper.instance.base_path = APP_ROOT
23
+
24
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
25
+ load 'rails/tasks/engine.rake'
26
+
27
+ desc "Run all specs in spec directory"
28
+ RSpec::Core::RakeTask.new(:spec => ["app:db:migrate", "app:db:test:prepare"])
29
+
30
+ desc "Run the CI build"
31
+ task :ci => ["jetty:clean"] do
32
+ Jettywrapper.wrap(JETTY_CONFIG) do
33
+ Rake::Task['spec'].invoke
34
+ end
35
+ end
36
+
37
+ task :default => :spec
@@ -0,0 +1,7 @@
1
+ class Attachment < Ddr::Models::Base
2
+
3
+ include Ddr::Models::HasContent
4
+
5
+ belongs_to :attached_to, property: :is_attached_to, class_name: 'ActiveFedora::Base'
6
+
7
+ end
@@ -0,0 +1,54 @@
1
+ class Collection < Ddr::Models::Base
2
+
3
+ include Hydra::AdminPolicyBehavior
4
+
5
+ include Ddr::Models::HasChildren
6
+ include Ddr::Models::HasAttachments
7
+
8
+ has_attributes :default_license_title, datastream: Ddr::Datastreams::DEFAULT_RIGHTS, at: [:license, :title], multiple: false
9
+ has_attributes :default_license_description, datastream: Ddr::Datastreams::DEFAULT_RIGHTS, at: [:license, :description], multiple: false
10
+ has_attributes :default_license_url, datastream: Ddr::Datastreams::DEFAULT_RIGHTS, at: [:license, :url], multiple: false
11
+
12
+ has_many :children, property: :is_member_of_collection, class_name: 'Item'
13
+ has_many :targets, property: :is_external_target_for, class_name: 'Target'
14
+
15
+ alias_method :items, :children
16
+ alias_method :item_ids, :child_ids
17
+
18
+ validates_presence_of :title
19
+
20
+ def components_from_solr
21
+ outer = Ddr::IndexFields::IS_PART_OF
22
+ inner = Ddr::IndexFields::INTERNAL_URI
23
+ where = ActiveFedora::SolrService.construct_query_for_rel(:is_member_of_collection => internal_uri)
24
+ query = "{!join to=#{outer} from=#{inner}}#{where}"
25
+ filter = ActiveFedora::SolrService.construct_query_for_rel(:has_model => Component.to_class_uri)
26
+ results = ActiveFedora::SolrService.query(query, fq: filter, rows: 100000)
27
+ results.lazy.map {|doc| SolrDocument.new(doc)}
28
+ end
29
+
30
+ def default_license
31
+ if default_license_title.present? or default_license_description.present? or default_license_url.present?
32
+ {title: default_license_title, description: default_license_description, url: default_license_url}
33
+ end
34
+ end
35
+
36
+ def default_license=(new_license)
37
+ raise ArgumentError unless new_license.is_a?(Hash)
38
+ l = new_license.with_indifferent_access
39
+ self.default_license_title = l[:title]
40
+ self.default_license_description = l[:description]
41
+ self.default_license_url = l[:url]
42
+ end
43
+
44
+ def default_entities_for_permission(type, access)
45
+ default_permissions.collect { |p| p[:name] if p[:type] == type and p[:access] == access }.compact
46
+ end
47
+
48
+ ["discover", "read", "edit"].each do |access|
49
+ ["user", "group"].each do |type|
50
+ define_method("default_#{access}_#{type}s") { default_entities_for_permission(type, access) }
51
+ end
52
+ end
53
+
54
+ end
@@ -0,0 +1,15 @@
1
+ class Component < Ddr::Models::Base
2
+
3
+ include Ddr::Models::HasContent
4
+
5
+ belongs_to :parent, :property => :is_part_of, :class_name => 'Item'
6
+ belongs_to :target, :property => :has_external_target, :class_name => 'Target'
7
+
8
+ alias_method :item, :parent
9
+ alias_method :item=, :parent=
10
+
11
+ def collection
12
+ self.parent.parent rescue nil
13
+ end
14
+
15
+ end
@@ -0,0 +1,19 @@
1
+ class Item < Ddr::Models::Base
2
+
3
+ include Ddr::Models::HasContentMetadata
4
+ include Ddr::Models::HasChildren
5
+
6
+ has_many :children, property: :is_part_of, class_name: 'Component'
7
+ belongs_to :parent, property: :is_member_of_collection, class_name: 'Collection'
8
+
9
+ alias_method :components, :children
10
+ alias_method :component_ids, :child_ids
11
+
12
+ alias_method :parts, :children
13
+ alias_method :part_ids, :child_ids
14
+
15
+ alias_method :collection, :parent
16
+ alias_method :collection_id, :parent_id
17
+ alias_method :collection=, :parent=
18
+
19
+ end
@@ -0,0 +1,36 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class SolrDocument
3
+
4
+ include Blacklight::Solr::Document
5
+
6
+ # self.unique_key = 'id'
7
+
8
+ # The following shows how to setup this blacklight document to display marc documents
9
+ # extension_parameters[:marc_source_field] = :marc_display
10
+ # extension_parameters[:marc_format_type] = :marcxml
11
+ # use_extension( Blacklight::Solr::Document::Marc) do |document|
12
+ # document.key?( :marc_display )
13
+ # end
14
+
15
+ # Email uses the semantic field mappings below to generate the body of an email.
16
+ SolrDocument.use_extension( Blacklight::Solr::Document::Email )
17
+
18
+ # SMS uses the semantic field mappings below to generate the body of an SMS email.
19
+ SolrDocument.use_extension( Blacklight::Solr::Document::Sms )
20
+
21
+ # DublinCore uses the semantic field mappings below to assemble an OAI-compliant Dublin Core document
22
+ # Semantic mappings of solr stored fields. Fields may be multi or
23
+ # single valued. See Blacklight::Solr::Document::ExtendableClassMethods#field_semantics
24
+ # and Blacklight::Solr::Document#to_semantic_values
25
+ # Recommendation: Use field names from Dublin Core
26
+ use_extension( Blacklight::Solr::Document::DublinCore)
27
+ field_semantics.merge!(
28
+ :title => "title_display",
29
+ :author => "author_display",
30
+ :language => "language_facet",
31
+ :format => "format"
32
+ )
33
+
34
+ include Ddr::Models::SolrDocument
35
+
36
+ end
@@ -0,0 +1,8 @@
1
+ class Target < Ddr::Models::Base
2
+
3
+ include Ddr::Models::HasContent
4
+
5
+ has_many :components, property: :has_external_target, class_name: 'Component'
6
+ belongs_to :collection, property: :is_external_target_for, class_name: 'Collection'
7
+
8
+ end
@@ -0,0 +1,77 @@
1
+ module ActiveFedora
2
+ class Base
3
+
4
+ def can_have_attachments?
5
+ has_association? :attachments
6
+ end
7
+
8
+ def has_attachments?
9
+ can_have_attachments? && attachments.size > 0
10
+ end
11
+
12
+ def can_have_children?
13
+ has_association? :children
14
+ end
15
+
16
+ def has_children?
17
+ can_have_children? and children.size > 0
18
+ end
19
+
20
+ def can_have_content?
21
+ datastreams.include? "content"
22
+ end
23
+
24
+ def has_content?
25
+ can_have_content? && content.has_content?
26
+ end
27
+
28
+ def has_content_metadata?
29
+ self.is_a?(DulHydra::HasContentMetadata) && self.datastreams[Ddr::Datastreams::CONTENT_METADATA].has_content?
30
+ end
31
+
32
+ def describable?
33
+ self.is_a? Ddr::Models::Describable
34
+ end
35
+
36
+ def governable?
37
+ has_association? :admin_policy
38
+ end
39
+
40
+ def has_admin_policy?
41
+ governable? && admin_policy.present?
42
+ end
43
+
44
+ def has_rights_metadata?
45
+ ds = self.datastreams[Ddr::Datastreams::RIGHTS_METADATA]
46
+ ds && ds.size && ds.size > 0
47
+ end
48
+
49
+ def can_have_thumbnail?
50
+ datastreams.include? "thumbnail"
51
+ end
52
+
53
+ def has_thumbnail?
54
+ can_have_thumbnail? && thumbnail.has_content?
55
+ end
56
+
57
+ def safe_id
58
+ id.sub(/:/, "-")
59
+ end
60
+
61
+ # For duck-typing with SolrDocument
62
+ def active_fedora_model
63
+ self.class.to_s
64
+ end
65
+
66
+ def controller_name
67
+ active_fedora_model.tableize
68
+ end
69
+
70
+ protected
71
+
72
+ def has_association? assoc
73
+ !association(assoc).nil?
74
+ end
75
+
76
+ end
77
+ end
@@ -0,0 +1,5 @@
1
+ module ActiveFedora
2
+ class Datastream
3
+ include Ddr::Datastreams::DatastreamBehavior
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ Ddr::Models.configure do |config|
2
+
3
+ config.external_file_store = ENV['EXTERNAL_FILE_STORE']
4
+ config.external_file_subpath_pattern = ENV['EXTERNAL_FILE_SUBPATH_PATTERN'] || "--"
5
+ config.noid_template = "2.reeddeeddk"
6
+ config.minter_statefile = Rails.env.test? ? "/tmp/minter-state" : ENV['MINTER_STATEFILE']
7
+
8
+ end
@@ -0,0 +1,245 @@
1
+ require 'devise'
2
+
3
+ # Use this hook to configure devise mailer, warden hooks and so forth.
4
+ # Many of these configuration options can be set straight in your model.
5
+ Devise.setup do |config|
6
+
7
+ # Given the modules that we implement, this shouldn't be used, but Devise >= 3.1 requires it,
8
+ # so a random value should suffice.
9
+ config.secret_key = SecureRandom.hex(64)
10
+
11
+ # ==> Mailer Configuration
12
+ # Configure the e-mail address which will be shown in Devise::Mailer,
13
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
14
+ config.mailer_sender = "lib-drs@duke.edu"
15
+
16
+ # Configure the class responsible to send e-mails.
17
+ # config.mailer = "Devise::Mailer"
18
+
19
+ # ==> ORM configuration
20
+ # Load and configure the ORM. Supports :active_record (default) and
21
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
22
+ # available as additional gems.
23
+ require 'devise/orm/active_record'
24
+
25
+ # ==> Configuration for any authentication mechanism
26
+ # Configure which keys are used when authenticating a user. The default is
27
+ # just :email. You can configure it to use [:username, :subdomain], so for
28
+ # authenticating a user, both parameters are required. Remember that those
29
+ # parameters are used only when authenticating and not when retrieving from
30
+ # session. If you need permissions, you should implement that in a before filter.
31
+ # You can also supply a hash where the value is a boolean determining whether
32
+ # or not authentication should be aborted when the value is not present.
33
+ config.authentication_keys = [ :username ]
34
+
35
+ # Configure parameters from the request object used for authentication. Each entry
36
+ # given should be a request method and it will automatically be passed to the
37
+ # find_for_authentication method and considered in your model lookup. For instance,
38
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
39
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
40
+ # config.request_keys = []
41
+
42
+ # Configure which authentication keys should be case-insensitive.
43
+ # These keys will be downcased upon creating or modifying a user and when used
44
+ # to authenticate or find a user. Default is :email.
45
+ config.case_insensitive_keys = [ :username ]
46
+
47
+ # Configure which authentication keys should have whitespace stripped.
48
+ # These keys will have whitespace before and after removed upon creating or
49
+ # modifying a user and when used to authenticate or find a user. Default is :email.
50
+ config.strip_whitespace_keys = [ :username ]
51
+
52
+ # Tell if authentication through request.params is enabled. True by default.
53
+ # It can be set to an array that will enable params authentication only for the
54
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
55
+ # enable it only for database (email + password) authentication.
56
+ config.params_authenticatable = [:database]
57
+
58
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
59
+ # It can be set to an array that will enable http authentication only for the
60
+ # given strategies, for example, `config.http_authenticatable = [:token]` will
61
+ # enable it only for token authentication.
62
+ # config.http_authenticatable = false
63
+
64
+ # If http headers should be returned for AJAX requests. True by default.
65
+ # config.http_authenticatable_on_xhr = true
66
+
67
+ # The realm used in Http Basic Authentication. "Application" by default.
68
+ # config.http_authentication_realm = "Application"
69
+
70
+ # It will change confirmation, password recovery and other workflows
71
+ # to behave the same regardless if the e-mail provided was right or wrong.
72
+ # Does not affect registerable.
73
+ # config.paranoid = true
74
+
75
+ # By default Devise will store the user in session. You can skip storage for
76
+ # :http_auth and :token_auth by adding those symbols to the array below.
77
+ # Notice that if you are skipping storage for all authentication paths, you
78
+ # may want to disable generating routes to Devise's sessions controller by
79
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
80
+ config.skip_session_storage = [:http_auth]
81
+
82
+ # ==> Configuration for :database_authenticatable
83
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
84
+ # using other encryptors, it sets how many times you want the password re-encrypted.
85
+ #
86
+ # Limiting the stretches to just one in testing will increase the performance of
87
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
88
+ # a value less than 10 in other environments.
89
+ config.stretches = Rails.env.test? ? 1 : 10
90
+
91
+ # Setup a pepper to generate the encrypted password.
92
+ # config.pepper = "37669e0c50042b93e63f790c4102864bace2ee0a30eecad6fca7d490f3124d855d8bc6d2978e5500fb266aab2b8c8003d9f202a1f23e4c2c8e8f105b7c46a68f"
93
+
94
+ # ==> Configuration for :confirmable
95
+ # A period that the user is allowed to access the website even without
96
+ # confirming his account. For instance, if set to 2.days, the user will be
97
+ # able to access the website for two days without confirming his account,
98
+ # access will be blocked just in the third day. Default is 0.days, meaning
99
+ # the user cannot access the website without confirming his account.
100
+ # config.allow_unconfirmed_access_for = 2.days
101
+
102
+ # If true, requires any email changes to be confirmed (exactly the same way as
103
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
104
+ # db field (see migrations). Until confirmed new email is stored in
105
+ # unconfirmed email column, and copied to email column on successful confirmation.
106
+ config.reconfirmable = true
107
+
108
+ # Defines which key will be used when confirming an account
109
+ config.confirmation_keys = [ :username ]
110
+
111
+ # ==> Configuration for :rememberable
112
+ # The time the user will be remembered without asking for credentials again.
113
+ # config.remember_for = 2.weeks
114
+
115
+ # If true, extends the user's remember period when remembered via cookie.
116
+ # config.extend_remember_period = false
117
+
118
+ # Options to be passed to the created cookie. For instance, you can set
119
+ # :secure => true in order to force SSL only cookies.
120
+ # config.rememberable_options = {}
121
+
122
+ # ==> Configuration for :validatable
123
+ # Range for password length. Default is 6..128.
124
+ # config.password_length = 6..128
125
+
126
+ # Email regex used to validate email formats. It simply asserts that
127
+ # an one (and only one) @ exists in the given string. This is mainly
128
+ # to give user feedback and not to assert the e-mail validity.
129
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
130
+
131
+ # ==> Configuration for :timeoutable
132
+ # The time you want to timeout the user session without activity. After this
133
+ # time the user will be asked for credentials again. Default is 30 minutes.
134
+ # config.timeout_in = 30.minutes
135
+
136
+ # If true, expires auth token on session timeout.
137
+ # config.expire_auth_token_on_timeout = false
138
+
139
+ # ==> Configuration for :lockable
140
+ # Defines which strategy will be used to lock an account.
141
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
142
+ # :none = No lock strategy. You should handle locking by yourself.
143
+ # config.lock_strategy = :failed_attempts
144
+
145
+ # Defines which key will be used when locking and unlocking an account
146
+ config.unlock_keys = [ :username ]
147
+
148
+ # Defines which strategy will be used to unlock an account.
149
+ # :email = Sends an unlock link to the user email
150
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
151
+ # :both = Enables both strategies
152
+ # :none = No unlock strategy. You should handle unlocking by yourself.
153
+ # config.unlock_strategy = :both
154
+
155
+ # Number of authentication tries before locking an account if lock_strategy
156
+ # is failed attempts.
157
+ # config.maximum_attempts = 20
158
+
159
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
160
+ # config.unlock_in = 1.hour
161
+
162
+ # ==> Configuration for :recoverable
163
+ #
164
+ # Defines which key will be used when recovering the password for an account
165
+ config.reset_password_keys = [ :username ]
166
+
167
+ # Time interval you can reset your password with a reset password key.
168
+ # Don't put a too small interval or your users won't have the time to
169
+ # change their passwords.
170
+ config.reset_password_within = 6.hours
171
+
172
+ # ==> Configuration for :encryptable
173
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
174
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
175
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
176
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
177
+ # REST_AUTH_SITE_KEY to pepper)
178
+ # config.encryptor = :sha512
179
+
180
+ # ==> Configuration for :token_authenticatable
181
+ # Defines name of the authentication token params key
182
+ # config.token_authentication_key = :auth_token
183
+
184
+ # ==> Scopes configuration
185
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
186
+ # "users/sessions/new". It's turned off by default because it's slower if you
187
+ # are using only default views.
188
+ # config.scoped_views = false
189
+
190
+ # Configure the default scope given to Warden. By default it's the first
191
+ # devise role declared in your routes (usually :user).
192
+ # config.default_scope = :user
193
+
194
+ # Set this configuration to false if you want /users/sign_out to sign out
195
+ # only the current scope. By default, Devise signs out all scopes.
196
+ # config.sign_out_all_scopes = true
197
+
198
+ # ==> Navigation configuration
199
+ # Lists the formats that should be treated as navigational. Formats like
200
+ # :html, should redirect to the sign in page when the user does not have
201
+ # access, but formats like :xml or :json, should return 401.
202
+ #
203
+ # If you have any extra navigational formats, like :iphone or :mobile, you
204
+ # should add them to the navigational formats lists.
205
+ #
206
+ # The "*/*" below is required to match Internet Explorer requests.
207
+ # config.navigational_formats = ["*/*", :html]
208
+
209
+ # The default HTTP method used to sign out a resource. Default is :delete.
210
+ config.sign_out_via = :get
211
+
212
+ # ==> OmniAuth
213
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
214
+ # up on your models and hooks.
215
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
216
+
217
+ # ==> Warden configuration
218
+ # If you want to use other strategies, that are not supported by Devise, or
219
+ # change the failure app, you can configure them inside the config.warden block.
220
+ #
221
+ # config.warden do |manager|
222
+ # manager.intercept_401 = false
223
+ # manager.default_strategies(:scope => :user).unshift :remote_user_authenticatable
224
+ # end
225
+
226
+ config.warden do |manager|
227
+ # :superuser scope
228
+ manager.serialize_into_session(:superuser) { |superuser| superuser.id }
229
+ manager.serialize_from_session(:superuser) { |id| User.find(id) }
230
+ end
231
+
232
+ # ==> Mountable engine configurations
233
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
234
+ # is mountable, there are some extra configurations to be taken into account.
235
+ # The following options are available, assuming the engine is mounted as:
236
+ #
237
+ # mount MyEngine, at: "/my_engine"
238
+ #
239
+ # The router that invoked `devise_for`, in the example above, would be:
240
+ # config.router_name = :my_engine
241
+ #
242
+ # When using omniauth, Devise cannot automatically set Omniauth path,
243
+ # so you need to do it manually. For the users scope, it would be:
244
+ # config.omniauth_path_prefix = "/my_engine/users/auth"
245
+ end