hyrax 2.0.0.beta4 → 2.0.0.beta5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_fixme.yml +0 -1
- data/.travis.yml +4 -3
- data/README.md +3 -3
- data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +22 -0
- data/app/actors/hyrax/actors/file_set_actor.rb +4 -0
- data/app/actors/hyrax/actors/transfer_request_actor.rb +23 -0
- data/app/assets/javascripts/hyrax/autocomplete/default.es6 +2 -1
- data/app/assets/stylesheets/hyrax/_file_manager.scss +3 -0
- data/app/controllers/hyrax/dashboard/collections_controller.rb +0 -1
- data/app/controllers/hyrax/my_controller.rb +1 -1
- data/app/forms/hyrax/forms/work_form.rb +5 -4
- data/app/helpers/hyrax/content_block_helper_behavior.rb +2 -2
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +0 -7
- data/app/indexers/hyrax/indexes_workflow.rb +1 -1
- data/app/models/admin_set.rb +1 -1
- data/app/models/concerns/hyrax/basic_metadata.rb +1 -1
- data/app/models/concerns/hyrax/in_admin_set.rb +1 -1
- data/app/models/concerns/hyrax/proxy_deposit.rb +0 -8
- data/app/models/concerns/hyrax/solr_document_behavior.rb +0 -11
- data/app/models/concerns/hyrax/user.rb +3 -3
- data/app/models/hyrax/orcid_validator.rb +6 -1
- data/app/services/hyrax/admin_set_create_service.rb +0 -1
- data/app/services/hyrax/default_middleware_stack.rb +1 -0
- data/app/services/hyrax/statistics/depositors/summary.rb +5 -1
- data/app/services/hyrax/statistics/over_time.rb +5 -1
- data/app/services/hyrax/statistics/query_service.rb +55 -0
- data/app/services/hyrax/statistics/works/count.rb +1 -1
- data/app/services/hyrax/workflow/status_list_service.rb +1 -1
- data/app/views/hyrax/base/_form.html.erb +2 -1
- data/app/views/hyrax/base/_form_files.html.erb +0 -2
- data/app/views/hyrax/base/_form_progress.html.erb +1 -1
- data/app/views/hyrax/base/_form_visibility_error.html.erb +3 -0
- data/app/views/hyrax/base/_show_actions.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_actions.html.erb +1 -1
- data/app/views/hyrax/dashboard/profiles/_edit_primary.html.erb +4 -1
- data/app/views/hyrax/dashboard/show_user.html.erb +3 -1
- data/app/views/hyrax/file_sets/_show_actions.html.erb +1 -1
- data/app/views/hyrax/homepage/_recent_document.html.erb +1 -1
- data/config/locales/hyrax.de.yml +9 -8
- data/hyrax.gemspec +2 -2
- data/lib/generators/hyrax/config_generator.rb +14 -16
- data/lib/generators/hyrax/templates/config/{hyrax.rb → initializers/hyrax.rb} +21 -0
- data/lib/generators/hyrax/templates/config/{mini_magick.rb → initializers/mini_magick.rb} +0 -0
- data/lib/generators/hyrax/templates/config/{redis_config.rb → initializers/redis_config.rb} +0 -0
- data/lib/hyrax.rb +2 -1
- data/lib/hyrax/configuration.rb +17 -10
- data/lib/hyrax/controlled_vocabularies.rb +9 -0
- data/{app/controlled_vocabularies → lib}/hyrax/controlled_vocabularies/location.rb +0 -0
- data/lib/hyrax/version.rb +1 -1
- data/spec/actors/hyrax/actors/create_with_remote_files_actor_spec.rb +36 -0
- data/spec/actors/hyrax/actors/file_set_actor_spec.rb +5 -1
- data/spec/actors/hyrax/actors/transfer_request_actor_spec.rb +43 -0
- data/spec/controllers/hyrax/admin/admin_sets_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/api/items_controller_spec.rb +4 -4
- data/spec/controllers/hyrax/batch_edits_controller_spec.rb +3 -6
- data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +87 -68
- data/spec/controllers/hyrax/dashboard/profiles_controller_spec.rb +5 -5
- data/spec/controllers/hyrax/file_sets_controller_spec.rb +7 -19
- data/spec/controllers/hyrax/fixity_checks_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +1 -3
- data/spec/controllers/hyrax/single_use_links_viewer_controller_spec.rb +2 -4
- data/spec/factories/admin_sets.rb +0 -4
- data/spec/forms/hyrax/forms/work_form_spec.rb +41 -0
- data/spec/helpers/hyrax/content_block_helper_spec.rb +6 -0
- data/spec/helpers/hyrax_helper_spec.rb +0 -13
- data/spec/indexers/hyrax/generic_work_indexer_spec.rb +4 -1
- data/spec/javascripts/autocomplete_spec.js.coffee +39 -4
- data/spec/jobs/fixity_check_job_spec.rb +1 -2
- data/spec/lib/hyrax/configuration_spec.rb +4 -2
- data/spec/models/admin_set_spec.rb +0 -24
- data/spec/models/collection_spec.rb +0 -13
- data/spec/models/file_set_spec.rb +0 -17
- data/spec/models/generic_work_spec.rb +0 -11
- data/spec/models/solr_document_spec.rb +0 -32
- data/spec/models/user_spec.rb +20 -5
- data/spec/presenters/hyrax/file_usage_spec.rb +3 -7
- data/spec/services/hyrax/admin_set_create_service_spec.rb +2 -2
- data/spec/services/hyrax/admin_set_service_spec.rb +2 -2
- data/spec/services/hyrax/change_content_depositor_service_spec.rb +2 -6
- data/spec/services/hyrax/collections_service_spec.rb +1 -1
- data/spec/services/hyrax/default_middleware_stack_spec.rb +1 -0
- data/spec/services/hyrax/import_url_failure_service_spec.rb +1 -3
- data/spec/services/hyrax/persist_directly_contained_output_file_service_spec.rb +2 -1
- data/spec/services/hyrax/repository_fixity_check_service_spec.rb +1 -3
- data/spec/services/hyrax/{query_service_spec.rb → statistics/query_service_spec.rb} +5 -3
- data/spec/services/hyrax/versioning_service_spec.rb +2 -5
- data/spec/services/hyrax/work_query_service_spec.rb +1 -1
- data/spec/services/hyrax/workflow/status_list_service_spec.rb +7 -2
- data/spec/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb_spec.rb +1 -4
- data/spec/views/hyrax/base/_form.html.erb_spec.rb +4 -11
- data/spec/views/hyrax/base/_form_progress.html.erb_spec.rb +14 -0
- data/spec/views/hyrax/collections/_show_document_list_row.html.erb_spec.rb +1 -3
- data/spec/views/hyrax/dashboard/collections/_show_document_list_row.html.erb_spec.rb +1 -3
- data/spec/views/hyrax/dashboard/profiles/edit.html.erb_spec.rb +24 -0
- data/spec/views/hyrax/dashboard/show_user_spec.rb +24 -0
- data/template.rb +1 -1
- metadata +18 -13
- data/app/services/hyrax/query_service.rb +0 -53
@@ -50,7 +50,7 @@ module Hyrax
|
|
50
50
|
def roles_for_user
|
51
51
|
Sipity::Workflow.all.flat_map do |wf|
|
52
52
|
workflow_roles_for_user_and_workflow(wf).map do |wf_role|
|
53
|
-
"#{wf.name}-#{wf_role.role.name}"
|
53
|
+
"#{wf.permission_template.admin_set_id}-#{wf.name}-#{wf_role.role.name}"
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -4,12 +4,13 @@
|
|
4
4
|
'param-key' => @form.model_name.param_key },
|
5
5
|
multipart: true
|
6
6
|
} do |f| %>
|
7
|
-
<% if f.object.errors.
|
7
|
+
<% if f.object.errors.any? %>
|
8
8
|
<div class="alert alert-danger alert-dismissable" role="alert">
|
9
9
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
10
10
|
<%= f.object.errors.full_messages_for(:base).send(SimpleForm.error_method) %>
|
11
11
|
<%= render 'form_in_works_error', f: f %>
|
12
12
|
<%= render 'form_ordered_members_error', f: f %>
|
13
|
+
<%= render 'form_visibility_error', f: f %>
|
13
14
|
</div>
|
14
15
|
<% end %>
|
15
16
|
<% if Flipflop.batch_upload? && f.object.new_record? %>
|
@@ -14,14 +14,12 @@
|
|
14
14
|
<span>Add files...</span>
|
15
15
|
<input type="file" name="files[]" multiple>
|
16
16
|
</span>
|
17
|
-
<% if browser_supports_directory_upload? %>
|
18
17
|
<!-- The fileinput-button span is used to style the file input field as button -->
|
19
18
|
<span id="addfolder" class="btn btn-success fileinput-button">
|
20
19
|
<span class="glyphicon glyphicon-plus"></span>
|
21
20
|
<span>Add folder...</span>
|
22
21
|
<input type="file" name="files[]" multiple directory webkitdirectory>
|
23
22
|
</span>
|
24
|
-
<% end %>
|
25
23
|
<button type="reset" class="btn btn-warning cancel hidden">
|
26
24
|
<span class="glyphicon glyphicon-ban-circle"></span>
|
27
25
|
<span>Cancel upload</span>
|
@@ -21,7 +21,7 @@
|
|
21
21
|
<div class="set-access-controls list-group-item">
|
22
22
|
<%= render 'form_visibility_component', f: f %>
|
23
23
|
</div>
|
24
|
-
<%
|
24
|
+
<% if Flipflop.proxy_deposit? && current_user.can_make_deposits_for.any? %>
|
25
25
|
<div class="list-group-item">
|
26
26
|
<%= f.input :on_behalf_of, collection: current_user.can_make_deposits_for.map(&:user_key), prompt: "Yourself" %>
|
27
27
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="show-actions">
|
2
2
|
<% if Hyrax.config.analytics? %>
|
3
|
-
<%= link_to "Analytics", presenter.stats_path, id: 'stats', class: 'btn btn-default' %>
|
3
|
+
<%= link_to "Analytics", presenter.stats_path, id: 'stats', class: 'btn btn-default', data: { turbolinks: false } %>
|
4
4
|
<% end %>
|
5
5
|
<% if presenter.editor? %>
|
6
6
|
<%= link_to "Edit", edit_polymorphic_path([main_app, presenter]), class: 'btn btn-default' %>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
<% if can? :destroy, presenter.solr_document %>
|
16
16
|
<%= link_to t('hyrax.collection.actions.delete.label'),
|
17
|
-
|
17
|
+
hyrax.dashboard_collection_path(presenter),
|
18
18
|
title: t('hyrax.collection.actions.delete.desc'),
|
19
19
|
class: 'btn btn-danger',
|
20
20
|
data: { confirm: t('hyrax.collection.actions.delete.confirmation'),
|
@@ -57,4 +57,7 @@
|
|
57
57
|
|
58
58
|
<%= f.button '<i class="glyphicon glyphicon-save"></i> Save Profile'.html_safe, type: 'submit', class: "btn btn-primary" %>
|
59
59
|
<% end %>
|
60
|
-
|
60
|
+
|
61
|
+
<% if Flipflop.proxy_deposit? %>
|
62
|
+
<%= render 'hyrax/dashboard/_index_partials/proxy_rights', user: @user %>
|
63
|
+
<% end %>
|
@@ -26,7 +26,9 @@
|
|
26
26
|
<h3 class="panel-title "><%= t("hyrax.dashboard.manage_proxies") %></h3>
|
27
27
|
</div>
|
28
28
|
<div class="panel-body">
|
29
|
-
|
29
|
+
<% if Flipflop.proxy_deposit? %>
|
30
|
+
<%= render 'hyrax/dashboard/_index_partials/proxy_rights', user: current_user %>
|
31
|
+
<% end %>
|
30
32
|
</div>
|
31
33
|
</div>
|
32
34
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="form-actions">
|
2
2
|
<% if Hyrax.config.analytics? %>
|
3
|
-
<%= link_to "Analytics", @presenter.stats_path, id: 'stats', class: 'btn btn-default' %>
|
3
|
+
<%= link_to "Analytics", @presenter.stats_path, id: 'stats', class: 'btn btn-default', data: { turbolinks: false } %>
|
4
4
|
<% end %>
|
5
5
|
|
6
6
|
<% if @presenter.editor? %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<td class="col-sm-2">
|
3
3
|
<%= link_to_profile recent_document.depositor("no depositor value") %>
|
4
4
|
<%= link_to [main_app, recent_document] do %>
|
5
|
-
<%= render_thumbnail_tag recent_document, { width: 45 },
|
5
|
+
<%= render_thumbnail_tag recent_document, { width: 45 }, suppress_link: true %>
|
6
6
|
<% end %>
|
7
7
|
</td>
|
8
8
|
<td>
|
data/config/locales/hyrax.de.yml
CHANGED
@@ -140,6 +140,7 @@ de:
|
|
140
140
|
2yrs: 2 Jahre nach der Deponierung
|
141
141
|
3yrs: 3 Jahre nach der Deponierung
|
142
142
|
6mos: 6 Monate nach der Deponierung
|
143
|
+
select: Wählen Sie die Sperrfrist aus.
|
143
144
|
visibility:
|
144
145
|
description: 'Nach dem Release-Datum können die Arbeiten in diesem Admin-Set eingesehen und heruntergeladen werden durch:'
|
145
146
|
everyone: Jeder - alle Arbeiten in diesem Admin-Set werden öffentlich sein
|
@@ -166,8 +167,8 @@ de:
|
|
166
167
|
success: Das Design wurde erfolgreich aktualisiert
|
167
168
|
features:
|
168
169
|
index:
|
169
|
-
|
170
|
-
|
170
|
+
action: Aktion
|
171
|
+
description: Beschreibung
|
171
172
|
feature: Charakteristisch
|
172
173
|
header: Charakteristik
|
173
174
|
sidebar:
|
@@ -186,8 +187,8 @@ de:
|
|
186
187
|
tasks: Aufgaben
|
187
188
|
technical: Charakteristik
|
188
189
|
transfers: Transfers
|
189
|
-
user_activity: Ihre Tätigkeit
|
190
190
|
user_activity: Ihre Aktivitäten
|
191
|
+
users: Benutzer verwalten
|
191
192
|
workflow_review: Review-Rückmeldung
|
192
193
|
workflow_roles: Workflow-Rollen
|
193
194
|
works: Arbeiten
|
@@ -204,13 +205,13 @@ de:
|
|
204
205
|
unpublished: Unveröffentlicht
|
205
206
|
user_deposits:
|
206
207
|
end_label: Ende [Voreinstellung]
|
207
|
-
|
208
|
+
heading: Von Benutzern hinterlegte Dateien anzeigen
|
208
209
|
start_label: Beginnend
|
209
210
|
works:
|
210
211
|
headers:
|
211
212
|
main: Statistik Arbeiten
|
212
213
|
total: 'Arbeiten gesamt:'
|
213
|
-
visibility: Summen nach Freigabe- und Sichtbarkeitsbeschränkungen
|
214
|
+
visibility: Summen nach Freigabe- und Sichtbarkeitsbeschränkungen
|
214
215
|
users:
|
215
216
|
index:
|
216
217
|
access_label: Letzter Zugriff
|
@@ -285,7 +286,7 @@ de:
|
|
285
286
|
requirements: Bedarf
|
286
287
|
items:
|
287
288
|
actions: Aktionen
|
288
|
-
date_uploaded: Datum Upload
|
289
|
+
date_uploaded: Datum Upload
|
289
290
|
empty: Diese %{type} hat keine Dateien zugeordnet. Klicken Sie auf "Bearbeiten", um weitere Dateien hinzuzufügen.
|
290
291
|
header: Artikel
|
291
292
|
thumbnail: Miniaturansicht
|
@@ -354,7 +355,7 @@ de:
|
|
354
355
|
create: Sammlung erstellen
|
355
356
|
create_new: Zu neuer Sammlung hinzufügen
|
356
357
|
no_collections: Sie haben keinen Zugang zu vorhandenen Sammlungen. Sie können eine neue Sammlung erstellen.
|
357
|
-
|
358
|
+
select_heading: 'Wählen Sie die Sammlung aus, um Ihre Dateien hinzuzufügen:'
|
358
359
|
title: Zur Sammlung hinzufügen
|
359
360
|
update: Update-Sammlung
|
360
361
|
collections:
|
@@ -857,7 +858,7 @@ de:
|
|
857
858
|
related_url: Zugehörige URL
|
858
859
|
title: Titel
|
859
860
|
visibility_after_embargo: Dann öffnen sie es bis zu
|
860
|
-
visibility_after_lease: Zugriffsbeschränkung nach diesem Zeitraum
|
861
|
+
visibility_after_lease: Zugriffsbeschränkung nach diesem Zeitraum
|
861
862
|
visibility_during_embargo: Beschränkt auf
|
862
863
|
visibility_during_lease: Ist vorhanden für
|
863
864
|
proxy_deposit_request:
|
data/hyrax.gemspec
CHANGED
@@ -55,7 +55,7 @@ EOF
|
|
55
55
|
# Pin more tightly because 0.x gems are potentially unstable
|
56
56
|
spec.add_dependency 'flot-rails', '~> 0.0.6'
|
57
57
|
spec.add_dependency 'almond-rails', '~> 0.1'
|
58
|
-
spec.add_dependency 'qa', '~>
|
58
|
+
spec.add_dependency 'qa', '~> 2.0' # questioning_authority
|
59
59
|
spec.add_dependency 'flipflop', '~> 2.3'
|
60
60
|
spec.add_dependency 'jquery-datatables-rails', '~> 3.4'
|
61
61
|
spec.add_dependency 'rdf-rdfxml' # controlled vocabulary importer
|
@@ -75,7 +75,7 @@ EOF
|
|
75
75
|
spec.add_dependency 'active-fedora', '>= 11.3.1'
|
76
76
|
spec.add_dependency 'linkeddata' # Required for getting values from geonames
|
77
77
|
|
78
|
-
spec.add_development_dependency 'engine_cart', '~> 1.
|
78
|
+
spec.add_development_dependency 'engine_cart', '~> 1.2'
|
79
79
|
spec.add_development_dependency 'mida', '~> 0.3'
|
80
80
|
spec.add_development_dependency 'database_cleaner', '~> 1.3'
|
81
81
|
spec.add_development_dependency 'solr_wrapper', '~> 1.1'
|
@@ -24,10 +24,8 @@ class Hyrax::ConfigGenerator < Rails::Generators::Base
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def simple_form_initializers
|
27
|
-
copy_file 'config/initializers/simple_form.rb'
|
28
|
-
|
29
|
-
copy_file 'config/initializers/simple_form_bootstrap.rb',
|
30
|
-
'config/initializers/simple_form_bootstrap.rb'
|
27
|
+
copy_file 'config/initializers/simple_form.rb'
|
28
|
+
copy_file 'config/initializers/simple_form_bootstrap.rb'
|
31
29
|
end
|
32
30
|
|
33
31
|
def configure_endnote
|
@@ -36,30 +34,30 @@ class Hyrax::ConfigGenerator < Rails::Generators::Base
|
|
36
34
|
end
|
37
35
|
|
38
36
|
def configure_redis
|
39
|
-
copy_file 'config/redis.yml'
|
40
|
-
copy_file 'config/
|
37
|
+
copy_file 'config/redis.yml'
|
38
|
+
copy_file 'config/initializers/redis_config.rb'
|
41
39
|
end
|
42
40
|
|
43
41
|
def create_initializer_config_file
|
44
|
-
copy_file 'config/
|
42
|
+
copy_file 'config/initializers/hyrax.rb'
|
45
43
|
end
|
46
44
|
|
47
45
|
# Add mini-magick configuration
|
48
46
|
def minimagick_config
|
49
|
-
copy_file 'config/
|
47
|
+
copy_file 'config/initializers/mini_magick.rb'
|
50
48
|
end
|
51
49
|
|
52
50
|
def tinymce_config
|
53
|
-
copy_file
|
51
|
+
copy_file 'config/tinymce.yml'
|
54
52
|
end
|
55
53
|
|
56
54
|
def inject_i18n
|
57
|
-
copy_file
|
58
|
-
copy_file
|
59
|
-
copy_file
|
60
|
-
copy_file
|
61
|
-
copy_file
|
62
|
-
copy_file
|
63
|
-
copy_file
|
55
|
+
copy_file 'config/locales/hyrax.en.yml'
|
56
|
+
copy_file 'config/locales/hyrax.es.yml'
|
57
|
+
copy_file 'config/locales/hyrax.zh.yml'
|
58
|
+
copy_file 'config/locales/hyrax.de.yml'
|
59
|
+
copy_file 'config/locales/hyrax.fr.yml'
|
60
|
+
copy_file 'config/locales/hyrax.it.yml'
|
61
|
+
copy_file 'config/locales/hyrax.pt-BR.yml'
|
64
62
|
end
|
65
63
|
end
|
@@ -11,6 +11,11 @@ Hyrax.config do |config|
|
|
11
11
|
# @see Hyrax::Configuration for additional details and defaults.
|
12
12
|
# config.default_active_workflow_name = 'default'
|
13
13
|
|
14
|
+
# Which RDF term should be used to relate objects to an admin set?
|
15
|
+
# If this is a new repository, you may want to set a custom predicate term here to
|
16
|
+
# avoid clashes if you plan to use the default (dct:isPartOf) for other relations.
|
17
|
+
# config.admin_set_predicate = ::RDF::DC.isPartOf
|
18
|
+
|
14
19
|
# Email recipient of messages sent via the contact form
|
15
20
|
# config.contact_email = "repo-admin@example.org"
|
16
21
|
|
@@ -196,6 +201,22 @@ Hyrax.config do |config|
|
|
196
201
|
rescue Errno::ENOENT
|
197
202
|
config.browse_everything = nil
|
198
203
|
end
|
204
|
+
|
205
|
+
## Whitelist all directories which can be used to ingest from the local file
|
206
|
+
# system.
|
207
|
+
#
|
208
|
+
# Any file, and only those, that is anywhere under one of the specified
|
209
|
+
# directories can be used by CreateWithRemoteFilesActor to add local files
|
210
|
+
# to works. Files uploaded by the user are handled separately and the
|
211
|
+
# temporary directory for those need not be included here.
|
212
|
+
#
|
213
|
+
# Default value includes BrowseEverything.config['file_system'][:home] if it
|
214
|
+
# is set, otherwise default is an empty list. You should only need to change
|
215
|
+
# this if you have custom ingestions using CreateWithRemoteFilesActor to
|
216
|
+
# ingest files from the file system that are not part of the BrowseEverything
|
217
|
+
# mount point.
|
218
|
+
#
|
219
|
+
# config.whitelisted_ingest_dirs = []
|
199
220
|
end
|
200
221
|
|
201
222
|
Date::DATE_FORMATS[:standard] = "%m/%d/%Y"
|
File without changes
|
File without changes
|
data/lib/hyrax.rb
CHANGED
@@ -23,11 +23,12 @@ module Hyrax
|
|
23
23
|
|
24
24
|
eager_autoload do
|
25
25
|
autoload :Arkivo
|
26
|
+
autoload :Collections
|
26
27
|
autoload :Configuration
|
28
|
+
autoload :ControlledVocabularies
|
27
29
|
autoload :RedisEventStore
|
28
30
|
autoload :ResourceSync
|
29
31
|
autoload :Zotero
|
30
|
-
autoload :Collections
|
31
32
|
end
|
32
33
|
|
33
34
|
# @api public
|
data/lib/hyrax/configuration.rb
CHANGED
@@ -97,10 +97,6 @@ module Hyrax
|
|
97
97
|
def max_days_between_fixity_checks
|
98
98
|
@max_days_between_fixity_checks ||= 7
|
99
99
|
end
|
100
|
-
alias max_days_between_audits max_days_between_fixity_checks
|
101
|
-
deprecation_deprecate max_days_between_audits: "use max_days_between_fixity_checks instead"
|
102
|
-
alias max_days_between_audits= max_days_between_fixity_checks=
|
103
|
-
deprecation_deprecate :max_days_between_audits= => "use max_days_between_fixity_checks= instead"
|
104
100
|
|
105
101
|
attr_writer :enable_noids
|
106
102
|
def enable_noids?
|
@@ -180,6 +176,18 @@ module Hyrax
|
|
180
176
|
@bagit_dir ||= "tmp/descriptions"
|
181
177
|
end
|
182
178
|
|
179
|
+
# @!attribute [w] whitelisted_ingest_dirs
|
180
|
+
# List of directories which can be used for local file system ingestion.
|
181
|
+
attr_writer :whitelisted_ingest_dirs
|
182
|
+
def whitelisted_ingest_dirs
|
183
|
+
@whitelisted_ingest_dirs ||= \
|
184
|
+
if defined? BrowseEverything
|
185
|
+
Array.wrap(BrowseEverything.config['file_system'].try(:[], :home)).compact
|
186
|
+
else
|
187
|
+
[]
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
183
191
|
callback.enable :after_create_concern, :after_create_fileset,
|
184
192
|
:after_update_content, :after_revert_content,
|
185
193
|
:after_update_metadata, :after_import_local_file_success,
|
@@ -297,6 +305,11 @@ module Hyrax
|
|
297
305
|
@active_deposit_agreement_acceptance
|
298
306
|
end
|
299
307
|
|
308
|
+
attr_writer :admin_set_predicate
|
309
|
+
def admin_set_predicate
|
310
|
+
@admin_set_predicate ||= ::RDF::Vocab::DC.isPartOf
|
311
|
+
end
|
312
|
+
|
300
313
|
attr_writer :work_requires_files
|
301
314
|
def work_requires_files?
|
302
315
|
return true if @work_requires_files.nil?
|
@@ -331,12 +344,6 @@ module Hyrax
|
|
331
344
|
@display_share_button_when_not_logged_in
|
332
345
|
end
|
333
346
|
|
334
|
-
alias always_display_share_button= display_share_button_when_not_logged_in=
|
335
|
-
deprecation_deprecate :always_display_share_button= => "use display_share_button_when_not_logged_in= instead"
|
336
|
-
|
337
|
-
alias always_display_share_button? display_share_button_when_not_logged_in?
|
338
|
-
deprecation_deprecate always_display_share_button?: "use display_share_button_when_not_logged_in? instead"
|
339
|
-
|
340
347
|
attr_writer :google_analytics_id
|
341
348
|
def google_analytics_id
|
342
349
|
@google_analytics_id ||= nil
|
File without changes
|
data/lib/hyrax/version.rb
CHANGED
@@ -51,11 +51,25 @@ RSpec.describe Hyrax::Actors::CreateWithRemoteFilesActor do
|
|
51
51
|
file_name: "here.txt" }]
|
52
52
|
end
|
53
53
|
|
54
|
+
before do
|
55
|
+
allow(Hyrax.config).to receive(:whitelisted_ingest_dirs).and_return(["/local/file/"])
|
56
|
+
end
|
57
|
+
|
54
58
|
it "attaches files" do
|
55
59
|
expect(IngestLocalFileJob).to receive(:perform_later).with(FileSet, "/local/file/here.txt", user)
|
56
60
|
expect(actor.create(environment)).to be true
|
57
61
|
end
|
58
62
|
|
63
|
+
context "with files from non-whitelisted directories" do
|
64
|
+
let(:file) { "file:///local/otherdir/test.txt" }
|
65
|
+
|
66
|
+
it "doesn't attach files" do
|
67
|
+
expect(actor).to receive(:validate_remote_url).and_call_original
|
68
|
+
expect(IngestLocalFileJob).not_to receive(:perform_later)
|
69
|
+
expect(actor.create(environment)).to be false
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
59
73
|
context "with spaces" do
|
60
74
|
let(:file) { "file:///local/file/ pigs .txt" }
|
61
75
|
|
@@ -65,4 +79,26 @@ RSpec.describe Hyrax::Actors::CreateWithRemoteFilesActor do
|
|
65
79
|
end
|
66
80
|
end
|
67
81
|
end
|
82
|
+
|
83
|
+
describe "#validate_remote_url" do
|
84
|
+
before do
|
85
|
+
allow(Hyrax.config).to receive(:whitelisted_ingest_dirs).and_return(['/test/', '/local/file/'])
|
86
|
+
end
|
87
|
+
|
88
|
+
it "accepts file: urls in whitelisted directories" do
|
89
|
+
expect(actor.send(:validate_remote_url, "file:///local/file/test.txt")).to be true
|
90
|
+
expect(actor.send(:validate_remote_url, "file:///local/file/subdirectory/test.txt")).to be true
|
91
|
+
expect(actor.send(:validate_remote_url, "file:///test/test.txt")).to be true
|
92
|
+
end
|
93
|
+
|
94
|
+
it "rejects file: urls outside whitelisted directories" do
|
95
|
+
expect(actor.send(:validate_remote_url, "file:///tmp/test.txt")).to be false
|
96
|
+
expect(actor.send(:validate_remote_url, "file:///test/../tmp/test.txt")).to be false
|
97
|
+
expect(actor.send(:validate_remote_url, "file:///test/")).to be false
|
98
|
+
end
|
99
|
+
|
100
|
+
it "accepts other types of urls" do
|
101
|
+
expect(actor.send(:validate_remote_url, "https://example.com/test.txt")).to be true
|
102
|
+
end
|
103
|
+
end
|
68
104
|
end
|