sufia 7.2.0 → 7.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +2 -0
  3. data/.rubocop.yml +3 -0
  4. data/.rubocop_todo.yml +1 -2
  5. data/.travis.yml +0 -1
  6. data/Gemfile +2 -1
  7. data/README.md +23 -106
  8. data/app/actors/sufia/apply_permission_template_actor.rb +19 -0
  9. data/app/actors/sufia/create_with_remote_files_actor.rb +2 -2
  10. data/app/actors/sufia/default_admin_set_actor.rb +42 -0
  11. data/app/actors/sufia/interpret_visibility_actor.rb +115 -0
  12. data/app/assets/images/collection.png +0 -0
  13. data/app/assets/javascripts/sufia.js +6 -0
  14. data/app/assets/javascripts/sufia/admin/admin_set/participants.es6 +9 -0
  15. data/app/assets/javascripts/sufia/admin/admin_set/visibility.es6 +134 -0
  16. data/app/assets/javascripts/sufia/admin/admin_set_controls.es6 +11 -0
  17. data/app/assets/javascripts/sufia/app.js +27 -5
  18. data/app/assets/javascripts/sufia/autocomplete.es6 +15 -0
  19. data/app/assets/javascripts/sufia/autocomplete/work.es6 +29 -0
  20. data/app/assets/javascripts/sufia/dashboard_actions.js +2 -4
  21. data/app/assets/javascripts/sufia/save_work/save_work_control.es6 +14 -2
  22. data/app/assets/javascripts/sufia/save_work/uploaded_files.es6 +7 -2
  23. data/app/assets/javascripts/sufia/save_work/visibility_component.es6 +245 -4
  24. data/app/assets/javascripts/sufia/select_work_type.es6 +38 -0
  25. data/app/assets/javascripts/sufia/workflow_actions_affix.js +14 -0
  26. data/app/assets/stylesheets/sufia/_dashboard.scss +50 -29
  27. data/app/assets/stylesheets/sufia/_footer.scss +30 -0
  28. data/app/assets/stylesheets/sufia/_header.scss +3 -4
  29. data/app/assets/stylesheets/sufia/_home-page.scss +10 -8
  30. data/app/assets/stylesheets/sufia/_select_work_type.scss +43 -0
  31. data/app/assets/stylesheets/sufia/_sufia.scss +4 -1
  32. data/app/assets/stylesheets/sufia/_variables.scss +3 -0
  33. data/app/assets/stylesheets/sufia/admin.scss +66 -169
  34. data/app/assets/stylesheets/sufia/blacklight_gallery.scss +17 -0
  35. data/app/authorities/qa/authorities/find_works.rb +15 -0
  36. data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +2 -1
  37. data/app/controllers/concerns/sufia/batch_uploads_controller_behavior.rb +26 -13
  38. data/app/controllers/concerns/sufia/collections_controller_behavior.rb +25 -0
  39. data/app/controllers/concerns/sufia/controller.rb +8 -0
  40. data/app/controllers/concerns/sufia/deny_access_override_behavior.rb +1 -1
  41. data/app/controllers/concerns/sufia/file_sets_controller_behavior.rb +5 -14
  42. data/app/controllers/concerns/sufia/homepage_controller_behavior.rb +2 -0
  43. data/app/controllers/concerns/sufia/users_controller_behavior.rb +18 -7
  44. data/app/controllers/concerns/sufia/works_controller_behavior.rb +13 -10
  45. data/app/controllers/my/collections_controller.rb +5 -0
  46. data/app/controllers/my/shares_controller.rb +5 -0
  47. data/app/controllers/my/works_controller.rb +5 -0
  48. data/app/controllers/stats_controller.rb +1 -1
  49. data/app/controllers/sufia/admin/admin_sets_controller.rb +20 -2
  50. data/app/controllers/sufia/admin/permission_template_accesses_controller.rb +15 -0
  51. data/app/controllers/sufia/admin/permission_templates_controller.rb +29 -0
  52. data/app/controllers/sufia/admin_controller.rb +2 -0
  53. data/app/controllers/sufia/trophies_controller.rb +0 -2
  54. data/app/forms/sufia/forms/admin_set_form.rb +19 -0
  55. data/app/forms/sufia/forms/batch_edit_form.rb +16 -6
  56. data/app/forms/sufia/forms/batch_upload_form.rb +3 -2
  57. data/app/forms/sufia/forms/permission_template_form.rb +115 -0
  58. data/app/forms/sufia/forms/work_form.rb +6 -0
  59. data/app/helpers/batch_edits_helper.rb +1 -1
  60. data/app/helpers/sufia/citations_behavior.rb +0 -5
  61. data/app/helpers/sufia/citations_behaviors/formatters.rb +0 -1
  62. data/app/helpers/sufia/sufia_helper_behavior.rb +38 -6
  63. data/app/indexers/sufia/collection_indexer.rb +6 -0
  64. data/app/jobs/batch_create_job.rb +7 -15
  65. data/app/models/batch_upload_item.rb +2 -0
  66. data/app/models/concerns/sufia/ability.rb +12 -1
  67. data/app/models/sufia/permission_template.rb +102 -0
  68. data/app/models/sufia/permission_template_access.rb +18 -0
  69. data/app/presenters/sufia/admin_set_presenter.rb +1 -1
  70. data/app/presenters/sufia/model_icon.rb +7 -0
  71. data/app/presenters/sufia/select_type_list_presenter.rb +37 -0
  72. data/app/presenters/sufia/select_type_presenter.rb +35 -0
  73. data/app/presenters/sufia/work_show_presenter.rb +0 -2
  74. data/app/search_builders/collection_search_builder.rb +0 -2
  75. data/app/search_builders/sufia/admin_set_search_builder.rb +24 -0
  76. data/app/search_builders/sufia/catalog_search_builder.rb +10 -4
  77. data/app/search_builders/sufia/find_works_search_builder.rb +44 -0
  78. data/app/search_builders/sufia/my_search_builder_behavior.rb +0 -4
  79. data/app/search_builders/sufia/my_works_search_builder.rb +1 -1
  80. data/app/services/sufia/actor_factory.rb +6 -2
  81. data/app/services/sufia/admin_set_create_service.rb +22 -0
  82. data/app/services/sufia/admin_set_service.rb +46 -16
  83. data/app/services/sufia/collection_thumbnail_path_service.rb +10 -0
  84. data/app/services/sufia/workflow/abstract_notification.rb +39 -0
  85. data/app/services/sufia/workflow/changes_required_notification.rb +22 -0
  86. data/app/services/sufia/workflow/complete_notification.rb +22 -0
  87. data/app/services/sufia/workflow/pending_review_notification.rb +21 -0
  88. data/app/services/sufia/workflow/workflow_by_admin_set_strategy.rb +15 -0
  89. data/app/views/_masthead.html.erb +4 -4
  90. data/app/views/_toolbar.html.erb +31 -9
  91. data/app/views/_user_util_links.html.erb +7 -7
  92. data/app/views/batch_edits/edit.html.erb +24 -12
  93. data/app/views/catalog/_thumbnail_list_collection.html.erb +1 -1
  94. data/app/views/collections/_form.html.erb +2 -2
  95. data/app/views/collections/_media_display.html.erb +1 -1
  96. data/app/views/curation_concerns/base/_find_work_widget.html.erb +16 -0
  97. data/app/views/curation_concerns/base/_form.html.erb +6 -0
  98. data/app/views/curation_concerns/base/_form_child_work_relationships.html.erb +1 -1
  99. data/app/views/curation_concerns/base/_form_metadata.html.erb +1 -1
  100. data/app/views/curation_concerns/base/_form_parent_work_relationships.html.erb +43 -0
  101. data/app/views/curation_concerns/base/_form_progress.html.erb +7 -4
  102. data/app/views/curation_concerns/base/_form_relationships.html.erb +6 -6
  103. data/app/views/curation_concerns/base/_form_share.html.erb +1 -2
  104. data/app/views/curation_concerns/base/_guts4form.html.erb +1 -1
  105. data/app/views/curation_concerns/base/_social_media.html.erb +1 -1
  106. data/app/views/curation_concerns/base/_workflow_actions_widget.erb +3 -0
  107. data/app/views/curation_concerns/base/edit.html.erb +1 -1
  108. data/app/views/curation_concerns/base/new.html.erb +1 -1
  109. data/app/views/curation_concerns/base/show.html.erb +4 -1
  110. data/app/views/curation_concerns/file_sets/_show_actions.html.erb +0 -3
  111. data/app/views/dashboard/_create_work_action.html.erb +20 -0
  112. data/app/views/dashboard/_index_partials/_heading_actions.html.erb +9 -22
  113. data/app/views/layouts/admin.html.erb +8 -68
  114. data/app/views/layouts/curation_concerns/1_column.html.erb +4 -31
  115. data/app/views/layouts/homepage.html.erb +15 -45
  116. data/app/views/layouts/sufia-dashboard.html.erb +1 -36
  117. data/app/views/layouts/sufia.html.erb +49 -0
  118. data/app/views/my/_document_list.html.erb +1 -1
  119. data/app/views/my/_facet_limit.html.erb +2 -2
  120. data/app/views/my/_index_partials/_default_group.html.erb +10 -10
  121. data/app/views/my/_index_partials/_list_collections.html.erb +1 -1
  122. data/app/views/my/_sort_and_per_page.html.erb +8 -8
  123. data/app/views/records/edit_fields/_rights.html.erb +0 -1
  124. data/app/views/shared/_footer.html.erb +1 -1
  125. data/app/views/shared/_select_work_type_modal.html.erb +34 -0
  126. data/app/views/sufia/admin/_collections.html.erb +31 -0
  127. data/app/views/sufia/admin/_sidebar.html.erb +35 -23
  128. data/app/views/sufia/admin/admin_sets/_form.html.erb +38 -15
  129. data/app/views/sufia/admin/admin_sets/_form_metadata.html.erb +2 -0
  130. data/app/views/sufia/admin/admin_sets/_form_participant_table.html.erb +21 -0
  131. data/app/views/sufia/admin/admin_sets/_form_participants.html.erb +68 -0
  132. data/app/views/sufia/admin/admin_sets/_form_visibility.html.erb +58 -0
  133. data/app/views/sufia/admin/admin_sets/index.html.erb +29 -33
  134. data/app/views/sufia/admin/admin_sets/show.html.erb +3 -0
  135. data/app/views/sufia/admin/show.html.erb +22 -19
  136. data/app/views/sufia/batch_uploads/_form.html.erb +2 -1
  137. data/app/views/sufia/homepage/index.html.erb +11 -3
  138. data/app/views/sufia/uploads/_js_templates.html.erb +15 -11
  139. data/app/views/users/_user_row.html.erb +10 -0
  140. data/app/views/users/index.html.erb +1 -12
  141. data/config/features.rb +2 -0
  142. data/config/locales/sufia.en.yml +122 -37
  143. data/config/routes.rb +4 -1
  144. data/db/migrate/20161021175854_create_permission_template.rb +11 -0
  145. data/db/migrate/20161021180154_create_permission_template_access.rb +11 -0
  146. data/db/migrate/20161116222307_add_release_to_permission_templates.rb +6 -0
  147. data/lib/generators/sufia/install_generator.rb +12 -3
  148. data/lib/generators/sufia/templates/catalog_controller.rb +3 -13
  149. data/lib/generators/sufia/templates/workflow.json.erb +65 -0
  150. data/lib/generators/sufia/upgrade700_generator.rb +1 -1
  151. data/lib/generators/sufia/work/templates/locale.en.yml.erb +37 -0
  152. data/lib/generators/sufia/{work_generator.rb → work/work_generator.rb} +25 -5
  153. data/lib/sufia.rb +0 -1
  154. data/lib/sufia/engine.rb +7 -0
  155. data/lib/sufia/move_all_works_to_admin_set.rb +8 -0
  156. data/lib/sufia/version.rb +1 -1
  157. data/lib/tasks/migrate.rake +8 -0
  158. data/spec/actors/sufia/apply_permission_template_actor_spec.rb +64 -0
  159. data/spec/actors/sufia/create_with_remote_files_actor_spec.rb +8 -0
  160. data/spec/actors/sufia/default_admin_set_actor_spec.rb +43 -0
  161. data/spec/actors/sufia/interpret_visibility_actor_spec.rb +266 -0
  162. data/spec/authorities/qa/authorities/find_works_spec.rb +55 -0
  163. data/spec/controllers/batch_edits_controller_spec.rb +1 -6
  164. data/spec/controllers/citations_controller_spec.rb +49 -10
  165. data/spec/controllers/collections_controller_spec.rb +39 -0
  166. data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +22 -1
  167. data/spec/controllers/dashboard_controller_spec.rb +0 -8
  168. data/spec/controllers/depositors_controller_spec.rb +2 -2
  169. data/spec/controllers/downloads_controller_spec.rb +2 -2
  170. data/spec/controllers/my/collections_controller_spec.rb +5 -0
  171. data/spec/controllers/my/shares_controller_spec.rb +5 -0
  172. data/spec/controllers/my/works_controller_spec.rb +5 -0
  173. data/spec/controllers/stats_controller_spec.rb +1 -1
  174. data/spec/controllers/sufia/admin/admin_sets_controller_spec.rb +33 -5
  175. data/spec/controllers/sufia/admin/permission_template_accesses_controller_spec.rb +36 -0
  176. data/spec/controllers/sufia/admin/permission_templates_controller_spec.rb +46 -0
  177. data/spec/controllers/sufia/admin_controller_spec.rb +6 -0
  178. data/spec/controllers/sufia/batch_uploads_controller_spec.rb +40 -42
  179. data/spec/controllers/sufia/homepage_controller_spec.rb +14 -0
  180. data/spec/controllers/sufia/trophies_controller_spec.rb +17 -4
  181. data/spec/controllers/users_controller_spec.rb +13 -4
  182. data/spec/factories/permission_template_accesses.rb +5 -0
  183. data/spec/factories/permission_templates.rb +5 -0
  184. data/spec/factories/sipity_entities.rb +7 -0
  185. data/spec/factories/users.rb +4 -0
  186. data/spec/factories/workflow_states.rb +6 -0
  187. data/spec/factories/workflows.rb +5 -0
  188. data/spec/features/admin_admin_set_spec.rb +6 -4
  189. data/spec/features/batch_edit_spec.rb +0 -1
  190. data/spec/features/collection_spec.rb +4 -4
  191. data/spec/features/edit_work_spec.rb +1 -0
  192. data/spec/features/work_show_spec.rb +10 -0
  193. data/spec/forms/sufia/forms/admin_set_form_spec.rb +2 -1
  194. data/spec/forms/sufia/forms/batch_edit_form_spec.rb +30 -0
  195. data/spec/forms/sufia/forms/permission_template_form_spec.rb +196 -0
  196. data/spec/forms/sufia/forms/work_form_spec.rb +35 -1
  197. data/spec/helpers/batch_edits_helper_spec.rb +4 -4
  198. data/spec/helpers/blacklight_helper_spec.rb +1 -1
  199. data/spec/helpers/sufia_helper_spec.rb +39 -7
  200. data/spec/indexers/sufia/collection_indexer_spec.rb +12 -0
  201. data/spec/javascripts/autocomplete_spec.js.coffee +46 -6
  202. data/spec/javascripts/visibility_component_spec.js +491 -0
  203. data/spec/jobs/batch_create_job_spec.rb +27 -28
  204. data/spec/lib/sufia/arkivo_spec.rb +14 -0
  205. data/spec/lib/sufia/controlled_vocabulary/importer/downloader_spec.rb +31 -0
  206. data/spec/lib/sufia/move_all_works_to_admin_set_spec.rb +13 -0
  207. data/spec/lib/sufia/zotero_spec.rb +8 -0
  208. data/spec/models/sufia/ability_spec.rb +54 -14
  209. data/spec/models/sufia/permission_template_spec.rb +144 -0
  210. data/spec/models/sufia/user_usage_stats_spec.rb +8 -2
  211. data/spec/presenters/sufia/homepage_presenter_spec.rb +1 -1
  212. data/spec/presenters/sufia/select_type_list_presenter_spec.rb +26 -0
  213. data/spec/presenters/sufia/select_type_presenter_spec.rb +21 -0
  214. data/spec/search_builder/sufia/admin_set_search_builder_spec.rb +57 -0
  215. data/spec/search_builder/sufia/catalog_search_builder_spec.rb +40 -14
  216. data/spec/search_builder/sufia/find_works_search_builder_spec.rb +60 -0
  217. data/spec/search_builder/sufia/my_shares_search_builder_spec.rb +4 -1
  218. data/spec/search_builder/sufia/single_admin_set_search_builder_spec.rb +5 -1
  219. data/spec/services/sufia/actor_factory_spec.rb +13 -5
  220. data/spec/services/sufia/admin_set_create_service_spec.rb +27 -0
  221. data/spec/services/sufia/admin_set_service_spec.rb +104 -17
  222. data/spec/services/sufia/workflow/changes_required_notification_spec.rb +32 -0
  223. data/spec/services/sufia/workflow/complete_notification_spec.rb +32 -0
  224. data/spec/services/sufia/workflow/pending_review_notification_spec.rb +31 -0
  225. data/spec/services/sufia/workflow/workflow_by_admin_set_strategy_spec.rb +22 -0
  226. data/spec/spec_helper.rb +24 -5
  227. data/spec/support/proxies.rb +1 -1
  228. data/spec/test_app_templates/lib/generators/test_app_generator.rb +4 -0
  229. data/spec/views/_toolbar.html.erb_spec.rb +23 -6
  230. data/spec/views/batch_edits/edit.html.erb_spec.rb +7 -1
  231. data/spec/views/collections/_form_for_select_collection.html.erb_spec.rb +1 -3
  232. data/spec/views/curation_concerns/base/_find_work_widget.html.erb_spec.rb +22 -0
  233. data/spec/views/curation_concerns/base/_form.html.erb_spec.rb +7 -0
  234. data/spec/views/curation_concerns/base/_form_child_work_relationships.html.erb_spec.rb +1 -0
  235. data/spec/views/curation_concerns/base/_form_parent_work_relationships.html.erb_spec.rb +114 -0
  236. data/spec/views/curation_concerns/base/_form_progress.html.erb_spec.rb +3 -2
  237. data/spec/views/curation_concerns/base/_social_media.html.erb_spec.rb +1 -1
  238. data/spec/views/curation_concerns/base/edit.html.erb_spec.rb +1 -1
  239. data/spec/views/curation_concerns/base/show.html.erb_spec.rb +5 -1
  240. data/spec/views/curation_concerns/file_sets/_show_actions.html.erb_spec.rb +2 -2
  241. data/spec/views/dashboard/create_work_action.html.erb_spec.rb +27 -0
  242. data/spec/views/dashboard/index_spec.rb +7 -2
  243. data/spec/views/my/_sort_and_per_page.html.erb_spec.rb +33 -0
  244. data/spec/views/shared/select_work_type_modal.html.erb_spec.rb +32 -0
  245. data/spec/views/sufia/admin/admin_sets/_form.html.erb_spec.rb +18 -0
  246. data/spec/views/sufia/admin/admin_sets/_form_participants.html.erb_spec.rb +13 -0
  247. data/spec/views/sufia/admin/admin_sets/_form_visibility.html.erb_spec.rb +23 -0
  248. data/spec/views/sufia/batch_uploads/_form.html.erb_spec.rb +2 -12
  249. data/spec/views/sufia/homepage/index.html.erb_spec.rb +29 -8
  250. data/sufia.gemspec +5 -6
  251. data/tasks/sufia-dev.rake +6 -10
  252. data/template.rb +15 -0
  253. metadata +140 -28
  254. data/app/assets/stylesheets/sufia/widgets.css +0 -288
  255. data/app/helpers/sufia/citations_behaviors/formatters/endnote_formatter.rb +0 -49
  256. data/app/models/domain_term.rb +0 -4
  257. data/app/views/citations/file.html.erb +0 -0
  258. data/app/views/records/_rights_modal.html.erb +0 -1
  259. data/db/migrate/20160328222160_create_local_authorities.rb +0 -50
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e82d102b1ebefbdcf3159286939f5441474cf3ce
4
- data.tar.gz: 2f7bc9edb6ab9d90d937784572f2d9c0872f1ab8
3
+ metadata.gz: f8da2d85b23ab091afabbe8a3fc3f547fff86b94
4
+ data.tar.gz: 149f28dc13a30a9141d30b3035c0afaa4cd087a6
5
5
  SHA512:
6
- metadata.gz: d1f345c73b9488a4846b11fb0272b8dae814e88ab9c1a0f559e78b91af54691a30d363430b70c27e36ba9cb24fa830ca5de182c0fd6d0d2a8ec3927769801bae
7
- data.tar.gz: 47aec3915b098278458093b316a4d15c19796bcc3a7c8755113b4971cba4f4d16a72388bdb3fda401f6ef9590a40048db9e5a160cd174ff9dffdfac4d38bd427
6
+ metadata.gz: 7dfb177dad78057657aecbabcb3afc5f72d821ec24b98e6d6d2a87795f7e14c23c400e80b8818eac2252850d414d3b912c4ab354ee2dc28a2b15d0dd69e31f5a
7
+ data.tar.gz: 6dd363cc82aabe925013a2e8bf2de2d2c77651dd29ac10c8cabd19bbac949dda976abfd9913a0c4c89e0dbbb8b4f5fa0a72d0c466add9b4d2f038d291d5d68dd
data/.codeclimate.yml CHANGED
@@ -23,6 +23,8 @@ engines:
23
23
  - javascript
24
24
  eslint:
25
25
  enabled: true
26
+ exclude_fingerprints:
27
+ - 673b54674f33c17cc8d5683c1e469b15
26
28
  config:
27
29
  extensions:
28
30
  - .es6
data/.rubocop.yml CHANGED
@@ -100,3 +100,6 @@ RSpec/NestedGroups:
100
100
 
101
101
  RSpec/LeadingSubject:
102
102
  Enabled: false
103
+
104
+ RSpec/MessageSpies:
105
+ Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -51,7 +51,7 @@ RSpec/NamedSubject:
51
51
  Enabled: false
52
52
 
53
53
  RSpec/ExampleLength:
54
- Max: 7
54
+ Max: 7
55
55
  Exclude:
56
56
  - 'spec/controllers/api/items_controller_spec.rb'
57
57
  - 'spec/controllers/authorities_controller_spec.rb'
@@ -113,4 +113,3 @@ RSpec/AnyInstance:
113
113
  - 'spec/presenters/sufia/work_usage_spec.rb'
114
114
  - 'spec/presenters/sufia/file_usage_spec.rb'
115
115
  - 'spec/services/sufia/repository_audit_service_spec.rb'
116
-
data/.travis.yml CHANGED
@@ -27,7 +27,6 @@ notifications:
27
27
  irc:
28
28
  channels:
29
29
  - "irc.freenode.org#scholarsphere"
30
- - "irc.freenode.org#projecthydra"
31
30
  template:
32
31
  - "%{repository}//%{branch}@%{commit} by %{author}: %{message} - %{build_url}"
33
32
  services:
data/Gemfile CHANGED
@@ -5,8 +5,9 @@ gemspec
5
5
 
6
6
  group :development, :test do
7
7
  gem "simplecov", require: false
8
- gem 'byebug' unless ENV['CI']
9
8
  gem 'coveralls', require: false
9
+ gem 'pry' unless ENV['CI']
10
+ gem 'pry-byebug' unless ENV['CI']
10
11
  end
11
12
 
12
13
  # BEGIN ENGINE_CART BLOCK
data/README.md CHANGED
@@ -27,15 +27,10 @@ Jump in: [![Slack Status](http://slack.projecthydra.org/badge.svg)](http://slack
27
27
  * [Environments](#environments)
28
28
  * [Ruby](#ruby)
29
29
  * [Creating a Sufia\-based app](#creating-a-sufia-based-app)
30
+ * [Redis](#redis)
30
31
  * [Rails](#rails)
31
- * [Sufia's Ruby\-related dependencies](#sufias-ruby-related-dependencies)
32
- * [Install Sufia](#install-sufia)
33
32
  * [Generate a primary work type](#generate-a-primary-work-type)
34
- * [Database tables and indexes](#database-tables-and-indexes)
35
- * [Start Redis](#start-redis)
36
- * [Start Solr](#start-solr)
37
- * [Start FCRepo](#start-fcrepo)
38
- * [Spin up the web server](#spin-up-the-web-server)
33
+ * [Start servers](#start-servers)
39
34
  * [Managing a Sufia\-based app](#managing-a-sufia-based-app)
40
35
  * [License](#license)
41
36
  * [Contributing](#contributing)
@@ -49,49 +44,7 @@ Sufia uses the full power of [Hydra](http://projecthydra.org/) and extends it to
49
44
 
50
45
  ## Feature list
51
46
 
52
- Sufia has the following features:
53
-
54
- * Multiple file upload, and folder uploads (for Chrome browser only)
55
- * Flexible user- and group-based access controls
56
- * Transcoding of audio and video files
57
- * Generation and validation of identifiers
58
- * Generation of derivatives (served from the filesystem, not the repository)
59
- * Fixity checking
60
- * Version control
61
- * Characterization of uploaded files
62
- * Forms for batch editing metadata
63
- * Faceted search and browse
64
- * Social media interaction
65
- * User profiles
66
- * User dashboard for file management
67
- * Highlighted files on profile
68
- * Sharing w/ groups and users
69
- * User notifications
70
- * Activity streams
71
- * Background jobs
72
- * Single-use links
73
- * Google Analytics for usage statistics
74
- * Integration w/ cloud storage providers
75
- * Google Scholar-specific metadata embedding
76
- * Schema.org microdata, Open Graph meta tags, and Twitter cards for rich snippets
77
- * User-managed collections for grouping files
78
- * Full-text indexing & searching
79
- * Responsive, fluid, Bootstrap 3-based UI
80
- * Dynamically configurable featured works and researchers on homepage
81
- * Proxy deposit and transfers of ownership
82
- * Integration with Zotero for automatic population of user content
83
- * Suggested values from controlled vocabularies provided by [Questioning Authority](https://github.com/projecthydra-labs/questioning_authority)
84
- * [ResourceSync](http://www.openarchives.org/rs/1.0/resourcesync) capability lists and resource lists
85
- * Administrative sets (curated collections)
86
- * Administrative dashboard, w/ feature flippers to turn features on and off in the UI
87
- * Contact form
88
- * Customizable banner image
89
- * Flexible object model: upload and manage single-file works, multi-file works, zero-file works, and works-within-works
90
- * Geonames integration for location-oriented metadata fields
91
- * Virus detection for uploaded files
92
- * Citation formatting suggestions
93
-
94
- See the [Sufia Management Guide](https://github.com/projecthydra/sufia/wiki/Sufia-Management-Guide) to learn which features listed above are turned on by default and which require configuration.
47
+ Sufia has many features. [Read more about what they are and how to turn them on](https://github.com/projecthydra/sufia/wiki/Feature-matrix). See the [Sufia Management Guide](https://github.com/projecthydra/sufia/wiki/Sufia-Management-Guide) to learn more.
95
48
 
96
49
  For non-technical documentation about Sufia, see its [documentation site](http://sufia.io/).
97
50
 
@@ -115,15 +68,15 @@ After installing the Prerequisites:
115
68
 
116
69
  Sufia 7.x requires the following software to work:
117
70
 
118
- 1. Solr version >= 5.x (tested up to 6.2.0)
119
- 1. [Fedora Commons](http://www.fedora-commons.org/) digital repository version >= 4.5.1 (tested up to 4.6.0)
71
+ 1. [Solr](http://lucene.apache.org/solr/) version >= 5.x (tested up to 6.3.0)
72
+ 1. [Fedora Commons](http://www.fedora-commons.org/) digital repository version >= 4.5.1 (tested up to 4.7.0)
120
73
  1. A SQL RDBMS (MySQL, PostgreSQL), though **note** that SQLite will be used by default if you're looking to get up and running quickly
121
74
  1. [Redis](http://redis.io/), a key-value store
122
75
  1. [ImageMagick](http://www.imagemagick.org/) with JPEG-2000 support
123
76
  1. [FITS](#characterization) version 0.8.x (0.8.5 is known to be good)
124
77
  1. [LibreOffice](#derivatives)
125
78
 
126
- **NOTE: If you do not already have Solr and Fedora instances you can use in your development environment, you may use hydra-jetty (instructions are provided below to get you up and running quickly and with minimal hassle).**
79
+ **NOTE: The [Sufia Development Guide](https://github.com/projecthydra/sufia/wiki/Sufia-Development-Guide) has instructions for installing Solr and Fedora in a development environment.**
127
80
 
128
81
  ### Characterization
129
82
 
@@ -154,32 +107,29 @@ We recommend either Ruby 2.3 or the latest 2.2 version.
154
107
 
155
108
  # Creating a Sufia-based app
156
109
 
157
- ## Rails
110
+ ## Redis
158
111
 
159
- Generate a new Rails application. We recommend the latest Rails 5.0 or 4.2 release.
112
+ [Redis](http://redis.io/) is a key-value store that Sufia uses to provide activity streams on repository objects and users, and to prevent race conditions as a global mutex when modifying order-persisting objects.
160
113
 
161
- ```
162
- gem install rails -v 5.0.0.1
163
- rails new my_app
164
- ```
114
+ Starting up Redis will depend on your operating system, and may in fact already be started on your system. You may want to consult the [Redis documentation](http://redis.io/documentation) for help doing this.
165
115
 
166
- ## Sufia's Ruby-related dependencies
116
+ ## Rails
167
117
 
168
- Add the following lines to your application's Gemfile.
118
+ Generate a new Rails application. We recommend the latest Rails 5.0 or 4.2 release.
169
119
 
170
120
  ```
171
- gem 'sufia', '7.2.0'
121
+ # If you don't already have Rails at your disposal...
122
+ gem install rails -v 5.0.0.1
123
+ rails new my_app -m https://raw.githubusercontent.com/projecthydra/sufia/master/template.rb
172
124
  ```
173
125
 
174
- Then install Sufia as a dependency of your app via `bundle install`
175
-
176
- ## Install Sufia
177
-
178
- Install Sufia into your app using its built-in install generator. This step adds a number of files that Sufia requires within your Rails app, including e.g. a number of database migrations.
126
+ Generating a new Rails application using Sufia's template above takes cares of a number of steps for you, including:
179
127
 
180
- ```
181
- rails generate sufia:install -f
182
- ```
128
+ * Adding Sufia (and any of its dependencies) to your application `Gemfile`, to declare that Sufia is a dependency of your application
129
+ * Running `bundle install`, to install Sufia and its dependencies
130
+ * Running Sufia's install generator, to add a number of files that Sufia requires within your Rails app, including e.g. database migrations
131
+ * Loading all of Sufia's database migrations into your application's database
132
+ * Loading Sufia's default workflows into your application's database
183
133
 
184
134
  ## Generate a primary work type
185
135
 
@@ -197,45 +147,12 @@ or
197
147
  rails generate sufia:work MovingImage
198
148
  ```
199
149
 
200
- ## Database tables and indexes
201
-
202
- Now that Sufia's required database migrations have been generated into your app, you'll need to load them into your application's database.
203
-
204
- ```
205
- rake db:migrate
206
- ```
207
-
208
- ## Start Redis
209
-
210
- [Redis](http://redis.io/) is a key-value store that Sufia uses to provide activity streams on repository objects and users, and to prevent race conditions as a global mutex when modifying order-persisting objects.
211
-
212
- Starting up Redis will depend on your operating system, and may in fact already be started on your system. You may want to consult the [Redis documentation](http://redis.io/documentation) for help doing this.
213
-
214
- ## Start Solr
215
-
216
- If you already have an instance of Solr that you would like to use, you may skip this step. Open a new terminal window and type:
217
- ```
218
- solr_wrapper -d solr/config/ --collection_name hydra-development
219
- ```
220
-
221
- You can check to see if Solr is started by going to [localhost:8983](http://localhost:8983/).
222
-
223
- ## Start FCRepo
224
-
225
- If you already have an instance of FCRepo that you would like to use, you may skip this step. Open a new terminal window and type:
226
-
227
- ```
228
- fcrepo_wrapper -p 8984
229
- ```
230
-
231
- You can check to see if FCRepo is started by going to [localhost:8984](http://localhost:8984/).
232
-
233
- ## Spin up the web server
150
+ ## Start servers
234
151
 
235
- To test-drive your new Sufia application, spin up the web server that Rails provides:
152
+ To test-drive your new Sufia application in development mode, spin up the servers that Sufia needs (Solr, Fedora, and Rails):
236
153
 
237
154
  ```
238
- rails server
155
+ rake hydra:server
239
156
  ```
240
157
 
241
158
  And now you should be able to browse to [localhost:3000](http://localhost:3000/) and see the application. Note that this web server is purely for development purposes; you will want to use a more fully featured [web server](#web-server) for production-like environments.
@@ -0,0 +1,19 @@
1
+ module Sufia
2
+ class ApplyPermissionTemplateActor < CurationConcerns::Actors::AbstractActor
3
+ def create(attributes)
4
+ add_edit_users(attributes)
5
+ next_actor.create(attributes)
6
+ end
7
+
8
+ protected
9
+
10
+ def add_edit_users(attributes)
11
+ return unless attributes[:admin_set_id].present?
12
+ template = Sufia::PermissionTemplate.find_by!(admin_set_id: attributes[:admin_set_id])
13
+ curation_concern.edit_users = template.access_grants.where(agent_type: 'user', access: 'manage').pluck(:agent_id)
14
+ curation_concern.edit_groups = template.access_grants.where(agent_type: 'group', access: 'manage').pluck(:agent_id)
15
+ curation_concern.read_users = template.access_grants.where(agent_type: 'user', access: 'view').pluck(:agent_id)
16
+ curation_concern.read_groups = template.access_grants.where(agent_type: 'group', access: 'view').pluck(:agent_id)
17
+ end
18
+ end
19
+ end
@@ -31,9 +31,9 @@ module Sufia
31
31
  actor = CurationConcerns::Actors::FileSetActor.new(fs, user)
32
32
  actor.create_metadata(curation_concern, visibility: curation_concern.visibility)
33
33
  fs.save!
34
- uri = URI.parse(url)
34
+ uri = URI.parse(URI.encode(url))
35
35
  if uri.scheme == 'file'
36
- IngestLocalFileJob.perform_later(fs, uri.path, user)
36
+ IngestLocalFileJob.perform_later(fs, URI.decode(uri.path), user)
37
37
  else
38
38
  ImportUrlJob.perform_later(fs, log(actor.user))
39
39
  end
@@ -0,0 +1,42 @@
1
+ module Sufia
2
+ # Ensures that the default AdminSet id is set if this form doesn't have
3
+ # an admin_set_id provided. This should come before the
4
+ # CurationConcerns::Actors::InitializeWorkflowActor, so that the correct
5
+ # workflow can be kicked off.
6
+ class DefaultAdminSetActor < CurationConcerns::Actors::AbstractActor
7
+ def create(attributes)
8
+ ensure_admin_set_attribute!(attributes)
9
+ next_actor.create(attributes)
10
+ end
11
+
12
+ def update(attributes)
13
+ ensure_admin_set_attribute!(attributes)
14
+ next_actor.update(attributes)
15
+ end
16
+
17
+ private
18
+
19
+ def ensure_admin_set_attribute!(attributes)
20
+ return if attributes[:admin_set_id].present?
21
+ attributes[:admin_set_id] = default_admin_set_id
22
+ end
23
+
24
+ DEFAULT_ID = 'admin_set/default'.freeze
25
+
26
+ def default_admin_set_id
27
+ create_default_admin_set unless default_exists?
28
+ DEFAULT_ID
29
+ end
30
+
31
+ def default_exists?
32
+ AdminSet.exists?(DEFAULT_ID)
33
+ end
34
+
35
+ # Creates the default AdminSet and an associated PermissionTemplate with workflow
36
+ def create_default_admin_set
37
+ AdminSet.create!(id: DEFAULT_ID, title: ['Default Admin Set']).tap do |_as|
38
+ PermissionTemplate.create!(admin_set_id: DEFAULT_ID, workflow_name: 'default')
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,115 @@
1
+ module Sufia
2
+ class InterpretVisibilityActor < CurationConcerns::Actors::InterpretVisibilityActor
3
+ # Override CC to ensure our custom 'validate' method is used
4
+ def create(attributes)
5
+ @intention = Intention.new(attributes)
6
+ attributes = @intention.sanitize_params
7
+ validate(attributes) && apply_visibility(attributes) && next_actor.create(attributes)
8
+ end
9
+
10
+ # Override CC to ensure our custom 'validate' method is used
11
+ def update(attributes)
12
+ @intention = Intention.new(attributes)
13
+ attributes = @intention.sanitize_params
14
+ validate(attributes) && apply_visibility(attributes) && next_actor.update(attributes)
15
+ end
16
+
17
+ private
18
+
19
+ # Validate against selected AdminSet's PermissionTemplate (if any)
20
+ def validate(attributes)
21
+ # If AdminSet was selected, look for its PermissionTemplate
22
+ template = Sufia::PermissionTemplate.find_by(admin_set_id: attributes[:admin_set_id]) if attributes[:admin_set_id].present?
23
+
24
+ validate_lease(template) && validate_release_type(template) && validate_visibility(attributes, template) && validate_embargo(attributes, template)
25
+ end
26
+
27
+ # Validate that a lease is allowed by AdminSet's PermissionTemplate
28
+ def validate_lease(template)
29
+ # Leases are only allowable if a template doesn't require a release period or have any specific visibility requirement
30
+ # (Note: permission template release/visibility options do not support leases)
31
+ return true unless @intention.wants_lease? && template.present? && (template.release_period.present? || template.visibility.present?)
32
+
33
+ curation_concern.errors.add(:visibility, 'Lease option is not allowed by permission template for selected AdminSet.')
34
+ false
35
+ end
36
+
37
+ # Validate the selected release settings against template, checking for when embargoes/leases are not allowed
38
+ def validate_release_type(template)
39
+ # It's valid as long as embargo is not specified when a template requires no release delays
40
+ return true unless @intention.wants_embargo? && template.present? && template.release_no_delay?
41
+
42
+ curation_concern.errors.add(:visibility, 'Visibility specified does not match permission template "no release delay" requirement for selected AdminSet.')
43
+ false
44
+ end
45
+
46
+ # Validate visibility complies with AdminSet template requirements
47
+ def validate_visibility(attributes, template)
48
+ # NOTE: For embargo/lease, attributes[:visibility] will be nil (see sanitize_params), so visibility will be validated as part of embargo/lease
49
+ return true unless attributes[:visibility].present?
50
+
51
+ # Validate against template's visibility requirements
52
+ return true if validate_template_visibility(attributes[:visibility], template)
53
+
54
+ curation_concern.errors.add(:visibility, 'Visibility specified does not match permission template visibility requirement for selected AdminSet.')
55
+ false
56
+ end
57
+
58
+ # When specified, validate embargo is a future date that complies with AdminSet template requirements (if any)
59
+ def validate_embargo(attributes, template)
60
+ return true unless @intention.wants_embargo?
61
+
62
+ embargo_release_date = parse_date(attributes[:embargo_release_date])
63
+
64
+ # When embargo required, date must be in future AND matches any template requirements
65
+ return true if valid_future_date?(embargo_release_date) &&
66
+ valid_template_embargo_date?(embargo_release_date, template) &&
67
+ valid_template_visibility_after_embargo?(attributes, template)
68
+
69
+ curation_concern.errors.add(:visibility, 'When setting visibility to "embargo" you must also specify embargo release date.') unless embargo_release_date.present?
70
+ false
71
+ end
72
+
73
+ # Validate an date attribute is in the future
74
+ def valid_future_date?(date, attribute_name: :embargo_release_date)
75
+ return true if date.present? && date.future?
76
+
77
+ curation_concern.errors.add(attribute_name, "Must be a future date.")
78
+ false
79
+ end
80
+
81
+ # Validate an embargo date against permission template restrictions
82
+ def valid_template_embargo_date?(date, template)
83
+ return true unless template.present?
84
+
85
+ # Validate against template's release_date requirements
86
+ return true if template.valid_release_date?(date)
87
+
88
+ curation_concern.errors.add(:embargo_release_date, "Release date specified does not match permission template release requirements for selected AdminSet.")
89
+ false
90
+ end
91
+
92
+ # Validate the post-embargo visibility against permission template requirements (if any)
93
+ def valid_template_visibility_after_embargo?(attributes, template)
94
+ # Validate against template's visibility requirements
95
+ return true if validate_template_visibility(attributes[:visibility_after_embargo], template)
96
+
97
+ curation_concern.errors.add(:visibility_after_embargo, "Visibility after embargo does not match permission template visibility requirements for selected AdminSet.")
98
+ false
99
+ end
100
+
101
+ # Validate that a given visibility value satisfies template requirements
102
+ def validate_template_visibility(visibility, template)
103
+ return true unless template.present?
104
+
105
+ template.valid_visibility?(visibility)
106
+ end
107
+
108
+ # Parse date from string. Returns nil if date_string is not a valid date
109
+ def parse_date(date_string)
110
+ datetime = Time.zone.parse(date_string) if date_string.present?
111
+ return datetime.to_date unless datetime.nil?
112
+ nil
113
+ end
114
+ end
115
+ end
Binary file
@@ -52,6 +52,9 @@
52
52
  //= require sufia/flot_stats
53
53
  // Provide AMD module support
54
54
  //= require almond
55
+ //= require sufia/admin/admin_set_controls
56
+ //= require sufia/admin/admin_set/participants
57
+ //= require sufia/admin/admin_set/visibility
55
58
  //= require sufia/save_work
56
59
  //= require sufia/permissions
57
60
  //= require sufia/notifications
@@ -59,7 +62,9 @@
59
62
  //= require sufia/autocomplete/location
60
63
  //= require sufia/autocomplete/subject
61
64
  //= require sufia/autocomplete/language
65
+ //= require sufia/autocomplete/work
62
66
  //= require sufia/relationships
67
+ //= require sufia/select_work_type
63
68
  //= require curation_concerns/collections
64
69
  //= require hydra-editor/hydra-editor
65
70
  //= require nestable
@@ -67,6 +72,7 @@
67
72
  //= require curation_concerns/file_manager/save_manager
68
73
  //= require curation_concerns/file_manager/member
69
74
  //= require curation_concerns/file_manager
75
+ //= require sufia/workflow_actions_affix
70
76
 
71
77
  // this needs to be after batch_select so that the form ids get setup correctly
72
78
  //= require sufia/batch_edit