hyrax 3.4.2 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dassie/config/analytics.yml +4 -2
- data/.regen +2 -1
- data/app/actors/hyrax/actors/collections_membership_actor.rb +1 -1
- data/app/actors/hyrax/actors/embargo_actor.rb +11 -4
- data/app/actors/hyrax/actors/lease_actor.rb +11 -4
- data/app/assets/javascripts/hyrax/analytics_events.js +88 -38
- data/app/assets/javascripts/hyrax/app.js.erb +1 -1
- data/app/assets/javascripts/hyrax/permissions/control.es6 +8 -1
- data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +11 -2
- data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +11 -2
- data/app/controllers/concerns/hyrax/manages_embargoes.rb +13 -1
- data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +2 -2
- data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +1 -1
- data/app/controllers/hyrax/admin/strategies_controller.rb +1 -1
- data/app/controllers/hyrax/admin/workflows_controller.rb +48 -3
- data/app/controllers/hyrax/dashboard/collections_controller.rb +1 -2
- data/app/controllers/hyrax/downloads_controller.rb +16 -1
- data/app/controllers/hyrax/file_sets_controller.rb +10 -1
- data/app/controllers/hyrax/permissions_controller.rb +1 -1
- data/app/controllers/hyrax/transfers_controller.rb +0 -2
- data/app/controllers/hyrax/workflow_actions_controller.rb +3 -2
- data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +2 -0
- data/app/forms/hyrax/forms/embargo.rb +13 -0
- data/app/forms/hyrax/forms/file_set_edit_form.rb +1 -1
- data/app/forms/hyrax/forms/file_set_form.rb +8 -35
- data/app/forms/hyrax/forms/lease.rb +13 -0
- data/app/forms/hyrax/forms/pcdm_object_form.rb +46 -0
- data/app/forms/hyrax/forms/resource_form.rb +36 -32
- data/app/forms/hyrax/forms/work_embargo_form.rb +35 -0
- data/app/forms/hyrax/forms/work_lease_form.rb +35 -0
- data/app/helpers/hyrax/embargo_helper.rb +11 -0
- data/app/helpers/hyrax/lease_helper.rb +11 -0
- data/app/indexers/hyrax/pcdm_collection_indexer.rb +1 -0
- data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +2 -8
- data/app/jobs/content_event_job.rb +1 -1
- data/app/models/concerns/hyrax/collection_behavior.rb +2 -1
- data/app/models/concerns/hyrax/collection_nesting.rb +10 -1
- data/app/models/concerns/hyrax/file_set_behavior.rb +1 -0
- data/app/models/concerns/hyrax/work_behavior.rb +2 -1
- data/app/models/hyrax/embargo.rb +1 -1
- data/app/models/hyrax/file_set.rb +3 -3
- data/app/models/hyrax/lease.rb +1 -1
- data/app/models/proxy_deposit_request.rb +1 -1
- data/app/presenters/hyrax/permission_badge.rb +3 -2
- data/app/presenters/hyrax/version_list_presenter.rb +6 -1
- data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +13 -5
- data/app/services/hyrax/analytics/ga4.rb +204 -0
- data/app/services/hyrax/analytics/google.rb +23 -15
- data/app/services/hyrax/analytics/matomo.rb +4 -3
- data/app/services/hyrax/collections/nested_collection_query_service.rb +1 -1
- data/app/services/hyrax/edit_permissions_service.rb +21 -3
- data/app/services/hyrax/embargo_manager.rb +9 -0
- data/app/services/hyrax/file_set_file_service.rb +55 -0
- data/app/services/hyrax/lease_manager.rb +9 -0
- data/app/services/hyrax/solr_query_service.rb +4 -4
- data/app/services/hyrax/user_stat_importer.rb +2 -0
- data/app/services/hyrax/versioning_service.rb +77 -9
- data/app/services/hyrax/visibility_propagator.rb +5 -5
- data/app/services/hyrax/work_resource_query_service.rb +45 -0
- data/app/services/hyrax/workflow/actionable_objects.rb +28 -3
- data/app/services/hyrax/workflow/permission_query.rb +23 -2
- data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +1 -1
- data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +1 -1
- data/app/views/hyrax/admin/workflows/_tabs.html.erb +9 -0
- data/app/views/hyrax/admin/workflows/index.html.erb +53 -78
- data/app/views/hyrax/base/_form_progress.html.erb +1 -1
- data/app/views/hyrax/base/_form_visibility_component.html.erb +5 -1
- data/app/views/hyrax/base/_show_actions.html.erb +1 -1
- data/app/views/hyrax/base/_work_button_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/_user_activity.html.erb +1 -1
- data/app/views/hyrax/dashboard/show_admin.html.erb +1 -1
- data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +1 -1
- data/app/views/hyrax/embargoes/edit.html.erb +3 -3
- data/app/views/hyrax/file_sets/_permission.html.erb +1 -1
- data/app/views/hyrax/file_sets/_permission_form.html.erb +1 -6
- data/app/views/hyrax/file_sets/_show_actions.html.erb +1 -1
- data/app/views/hyrax/file_sets/edit.html.erb +2 -2
- data/app/views/hyrax/leases/edit.html.erb +3 -3
- data/app/views/hyrax/transfers/new.html.erb +1 -1
- data/app/views/layouts/_head_tag_content.html.erb +5 -2
- data/app/views/shared/_ga4.html.erb +10 -0
- data/config/locales/hyrax.de.yml +2 -1
- data/config/locales/hyrax.en.yml +11 -0
- data/config/locales/hyrax.es.yml +1 -0
- data/config/locales/hyrax.fr.yml +2 -1
- data/config/locales/hyrax.it.yml +1 -0
- data/config/locales/hyrax.pt-BR.yml +1 -0
- data/config/locales/hyrax.zh.yml +1 -0
- data/config/metadata/file_set_metadata.yaml +130 -0
- data/documentation/developing-your-hyrax-based-app.md +2 -2
- data/documentation/legacyREADME.md +3 -3
- data/hyrax.gemspec +3 -1
- data/lib/generators/hyrax/templates/config/analytics.yml +3 -0
- data/lib/generators/hyrax/templates/config/locales/hyrax.de.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.en.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.es.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.fr.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.it.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.zh.yml +1 -1
- data/lib/hyrax/active_fedora_dummy_model.rb +13 -0
- data/lib/hyrax/configuration.rb +9 -2
- data/lib/hyrax/errors.rb +2 -0
- data/lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb +6 -0
- data/lib/hyrax/specs/shared_specs/indexers.rb +5 -0
- data/lib/hyrax/version.rb +1 -1
- data/lib/wings/valkyrie/storage.rb +6 -2
- data/template.rb +1 -1
- metadata +48 -5
- data/.github/workflows/main.yml +0 -17
- data/.github/workflows/release.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48404af16c40c5a6144f84f4747f391276dbbf03901c49947658904296ad1510
|
4
|
+
data.tar.gz: 6836a04cd80c63455b5670c591c102d5ac20224cd3746051eb6df0fc17daaaf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10235f122db54b7d649c42208982e93eee952d16ee921c4db12ab8e42fb3a30d4834e1a9ae509bec3aa8de9427d05bb78725f06ec9ce0455093ea58cc02c2cd8
|
7
|
+
data.tar.gz: 5e8df023cfdff3daedba28bdd012ddb7dbf26d8ef12dab69b6e648d4aca742db5948830510a5890a12f1220ca8f5350991ce95156bbab6f559c2669b6e1f10be
|
@@ -1,13 +1,15 @@
|
|
1
1
|
analytics:
|
2
|
+
ga4:
|
3
|
+
analytics_id: <%= ENV['GOOGLE_ANALYTICS_ID'] %>
|
2
4
|
google:
|
3
5
|
analytics_id: <%= ENV['GOOGLE_ANALYTICS_ID'] %>
|
4
6
|
app_name: <%= ENV['GOOGLE_OAUTH_APP_NAME'] %>
|
5
7
|
app_version: <%= ENV['GOOGLE_OAUTH_APP_VERSION'] %>
|
8
|
+
privkey_value: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_VALUE'] %>
|
6
9
|
privkey_path: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_PATH'] %>
|
7
10
|
privkey_secret: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_SECRET'] %>
|
8
11
|
client_email: <%= ENV['GOOGLE_OAUTH_CLIENT_EMAIL'] %>
|
9
|
-
matomo:
|
12
|
+
matomo:
|
10
13
|
base_url: <%= ENV['MATOMO_BASE_URL'] %>
|
11
14
|
site_id: <%= ENV['MATOMO_SITE_ID'] %>
|
12
15
|
auth_token: <%= ENV['MATOMO_AUTH_TOKEN'] %>
|
13
|
-
|
data/.regen
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
# When updating CI regen seed, set to current date.
|
2
|
+
2023-05-24T10:43:07
|
@@ -70,7 +70,7 @@ module Hyrax
|
|
70
70
|
# along side the FileSets on the show page
|
71
71
|
def add(env, id)
|
72
72
|
collection = Hyrax.config.collection_class.find(id)
|
73
|
-
collection.reindex_extent
|
73
|
+
collection.try(:reindex_extent=, Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX)
|
74
74
|
|
75
75
|
return unless env.current_ability.can?(:deposit, collection)
|
76
76
|
env.curation_concern.member_of_collections << collection
|
@@ -12,10 +12,17 @@ module Hyrax
|
|
12
12
|
# Update the visibility of the work to match the correct state of the embargo, then clear the embargo date, etc.
|
13
13
|
# Saves the embargo and the work
|
14
14
|
def destroy
|
15
|
-
work
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
case work
|
16
|
+
when Valkyrie::Resource
|
17
|
+
embargo_manager = Hyrax::EmbargoManager.new(resource: work)
|
18
|
+
embargo_manager.release && Hyrax::AccessControlList(work).save
|
19
|
+
embargo_manager.nullify
|
20
|
+
else
|
21
|
+
work.embargo_visibility! # If the embargo has lapsed, update the current visibility.
|
22
|
+
work.deactivate_embargo!
|
23
|
+
work.embargo.save!
|
24
|
+
work.save!
|
25
|
+
end
|
19
26
|
end
|
20
27
|
end
|
21
28
|
end
|
@@ -12,10 +12,17 @@ module Hyrax
|
|
12
12
|
# Update the visibility of the work to match the correct state of the lease, then clear the lease date, etc.
|
13
13
|
# Saves the lease and the work
|
14
14
|
def destroy
|
15
|
-
work
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
case work
|
16
|
+
when Valkyrie::Resource
|
17
|
+
lease_manager = Hyrax::LeaseManager.new(resource: work)
|
18
|
+
lease_manager.release && Hyrax::AccessControlList(work).save
|
19
|
+
lease_manager.nullify
|
20
|
+
else
|
21
|
+
work.lease_visibility! # If the lease has lapsed, update the current visibility.
|
22
|
+
work.deactivate_lease!
|
23
|
+
work.lease.save!
|
24
|
+
work.save!
|
25
|
+
end
|
19
26
|
end
|
20
27
|
end
|
21
28
|
end
|
@@ -1,75 +1,125 @@
|
|
1
1
|
class TrackingTags {
|
2
2
|
constructor(provider) {
|
3
3
|
this.provider = provider
|
4
|
+
switch(this.provider) {
|
5
|
+
case 'matomo':
|
6
|
+
this.tracker = new MatomoTagTracker();
|
7
|
+
break;
|
8
|
+
case 'google':
|
9
|
+
this.tracker = new UATagTracker();
|
10
|
+
break;
|
11
|
+
case 'ga4':
|
12
|
+
this.tracker = new GA4TagTracker();
|
13
|
+
break;
|
14
|
+
default:
|
15
|
+
console.error('Unsupport analytics provider ' + this.provider + ', supported values are: matomo, google, ga4');
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
// Track an event with the configured provider
|
20
|
+
trackTagEvent(category, action, name) {
|
21
|
+
this.tracker.trackEvent(category, action, name);
|
4
22
|
}
|
5
23
|
|
24
|
+
// Track a page view with the configured provider
|
25
|
+
trackPageView() {
|
26
|
+
this.tracker.trackPageView();
|
27
|
+
}
|
28
|
+
|
29
|
+
// Deprecated: use trackTagEvent and trackPageView instead.
|
6
30
|
analytics() {
|
7
|
-
|
8
|
-
return _paq;
|
9
|
-
}
|
10
|
-
else {
|
11
|
-
return _gaq;
|
12
|
-
}
|
31
|
+
return this;
|
13
32
|
}
|
14
33
|
|
15
|
-
|
16
|
-
|
17
|
-
|
34
|
+
// Deprecated: use trackTagEvent and trackPageView instead.
|
35
|
+
push(params) {
|
36
|
+
if (params[0] == 'trackPageView' || params[0] == '_trackPageView') {
|
37
|
+
this.tracker.trackPageView();
|
18
38
|
} else {
|
19
|
-
|
39
|
+
this.tracker.trackTagEvent(params[1], params[2], params[3]);
|
20
40
|
}
|
21
41
|
}
|
22
42
|
|
43
|
+
// Deprecated
|
44
|
+
pageView() {
|
45
|
+
return 'trackPageView';
|
46
|
+
}
|
47
|
+
|
48
|
+
// Deprecated
|
23
49
|
trackEvent() {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
50
|
+
return 'trackEvent';
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
class GA4TagTracker {
|
55
|
+
trackEvent(category, action, name) {
|
56
|
+
gtag('event', action, {
|
57
|
+
'category': category,
|
58
|
+
'label': name
|
59
|
+
});
|
60
|
+
}
|
61
|
+
|
62
|
+
trackPageView() {
|
63
|
+
// No operation necessary, this event is automatically collected
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
class UATagTracker {
|
68
|
+
trackEvent(category, action, name) {
|
69
|
+
_gaq.push(['_trackEvent', category, action, name]);
|
70
|
+
}
|
71
|
+
|
72
|
+
trackPageView() {
|
73
|
+
_gaq.push(['_trackPageView']);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
class MatomoTagTracker {
|
78
|
+
trackEvent(category, action, name) {
|
79
|
+
_paq.push(['trackEvent', category, action, name]);
|
80
|
+
}
|
81
|
+
|
82
|
+
trackPageView() {
|
83
|
+
_paq.push(['trackPageView']);
|
29
84
|
}
|
30
85
|
}
|
31
86
|
|
32
87
|
function trackPageView() {
|
33
|
-
window.trackingTags.
|
88
|
+
window.trackingTags.trackPageView();
|
34
89
|
}
|
35
90
|
|
36
91
|
function trackAnalyticsEvents() {
|
37
92
|
$('span.analytics-event').each(function(){
|
38
|
-
var eventSpan = $(this)
|
39
|
-
window.trackingTags.
|
93
|
+
var eventSpan = $(this);
|
94
|
+
window.trackingTags.trackTagEvent(eventSpan.data('category'), eventSpan.data('action'), eventSpan.data('name'));
|
40
95
|
})
|
41
96
|
}
|
42
97
|
|
43
98
|
function setupTracking() {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
99
|
+
var provider = $('meta[name="analytics-provider"]').prop('content')
|
100
|
+
if (provider === undefined) {
|
101
|
+
return;
|
102
|
+
}
|
103
|
+
window.trackingTags = new TrackingTags(provider);
|
104
|
+
trackPageView();
|
105
|
+
trackAnalyticsEvents();
|
51
106
|
}
|
52
107
|
|
53
108
|
if (typeof Turbolinks !== 'undefined') {
|
54
109
|
$(document).on('turbolinks:load', function() {
|
55
|
-
setupTracking()
|
56
|
-
})
|
110
|
+
setupTracking();
|
111
|
+
});
|
57
112
|
} else {
|
58
113
|
$(document).on('ready', function() {
|
59
|
-
setupTracking()
|
60
|
-
})
|
114
|
+
setupTracking();
|
115
|
+
});
|
61
116
|
}
|
62
117
|
|
63
118
|
$(document).on('click', '#file_download', function(e) {
|
64
|
-
|
65
|
-
|
66
|
-
return;
|
67
|
-
}
|
68
|
-
window.trackingTags = new TrackingTags(provider)
|
69
|
-
window.trackingTags.analytics().push([trackingTags.trackEvent(), 'file-set', 'file-set-download', $(this).data('label')]);
|
70
|
-
window.trackingTags.analytics().push([trackingTags.trackEvent(), 'file-set-in-work', 'file-set-in-work-download', $(this).data('work-id')]);
|
119
|
+
window.trackingTags.trackTagEvent('file-set', 'file-set-download', $(this).data('label'));
|
120
|
+
window.trackingTags.trackTagEvent('file-set-in-work', 'file-set-in-work-download', $(this).data('work-id'));
|
71
121
|
$(this).data('collection-ids').forEach(function (collection) {
|
72
|
-
window.trackingTags.
|
73
|
-
window.trackingTags.
|
122
|
+
window.trackingTags.trackTagEvent('file-set-in-collection', 'file-set-in-collection-download', collection);
|
123
|
+
window.trackingTags.trackTagEvent('work-in-collection', 'work-in-collection-download', collection);
|
74
124
|
});
|
75
125
|
});
|
@@ -104,7 +104,7 @@ Hyrax = {
|
|
104
104
|
// On the edit work page
|
105
105
|
new PermissionsControl($("#share"), 'tmpl-work-grant');
|
106
106
|
// On the edit fileset page
|
107
|
-
new PermissionsControl($("#permission"), 'tmpl-file-set-grant');
|
107
|
+
new PermissionsControl($("#permission"), 'tmpl-file-set-grant', { with_visibility_component: true });
|
108
108
|
// On the batch edit page
|
109
109
|
new PermissionsControl($("#form_permissions"), 'tmpl-work-grant');
|
110
110
|
// On the edit collection page
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Registry } from './registry'
|
2
2
|
import { UserControls } from './user_controls'
|
3
3
|
import { GroupControls } from './group_controls'
|
4
|
+
import VisibilityComponent from '../save_work/visibility_component'
|
4
5
|
|
5
6
|
export default class PermissionsControl {
|
6
7
|
/**
|
@@ -8,7 +9,8 @@ export default class PermissionsControl {
|
|
8
9
|
* @param {jQuery} element the jquery selector for the permissions container
|
9
10
|
* @param {String} template_id the identifier of the template for the added elements
|
10
11
|
*/
|
11
|
-
constructor(element, template_id) {
|
12
|
+
constructor(element, template_id, options = {}) {
|
13
|
+
const { with_visibility_component } = options
|
12
14
|
if (element.length === 0) {
|
13
15
|
return
|
14
16
|
}
|
@@ -17,6 +19,11 @@ export default class PermissionsControl {
|
|
17
19
|
this.registry = new Registry(this.element, this.object_name(), template_id)
|
18
20
|
this.user_controls = new UserControls(this.element, this.registry)
|
19
21
|
this.group_controls = new GroupControls(this.element, this.registry)
|
22
|
+
if (with_visibility_component) {
|
23
|
+
this.visibility_component = new VisibilityComponent(this.element)
|
24
|
+
} else {
|
25
|
+
this.visibility_component = null
|
26
|
+
}
|
20
27
|
}
|
21
28
|
|
22
29
|
// retrieve object_name the name of the object to create
|
@@ -15,8 +15,8 @@ module Hyrax
|
|
15
15
|
# Removes a single embargo
|
16
16
|
def destroy
|
17
17
|
Hyrax::Actors::EmbargoActor.new(curation_concern).destroy
|
18
|
-
flash[:notice] = curation_concern
|
19
|
-
if curation_concern.work? && curation_concern
|
18
|
+
flash[:notice] = embargo_history(curation_concern)
|
19
|
+
if curation_concern.work? && work_has_file_set_members?(curation_concern)
|
20
20
|
redirect_to confirm_permission_path
|
21
21
|
else
|
22
22
|
redirect_to edit_embargo_path
|
@@ -60,10 +60,19 @@ module Hyrax
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def edit
|
63
|
+
@curation_concern = Hyrax::Forms::WorkEmbargoForm.new(curation_concern).prepopulate! if
|
64
|
+
Hyrax.config.use_valkyrie?
|
63
65
|
add_breadcrumb t(:'hyrax.controls.home'), root_path
|
64
66
|
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
|
65
67
|
add_breadcrumb t(:'hyrax.embargoes.index.manage_embargoes'), hyrax.embargoes_path
|
66
68
|
add_breadcrumb t(:'hyrax.embargoes.edit.embargo_update'), '#'
|
67
69
|
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def embargo_history(concern)
|
74
|
+
concern.try(:embargo_history) ||
|
75
|
+
concern.try(:embargo)&.embargo_history
|
76
|
+
end
|
68
77
|
end
|
69
78
|
end
|
@@ -15,8 +15,8 @@ module Hyrax
|
|
15
15
|
# Removes a single lease
|
16
16
|
def destroy
|
17
17
|
Hyrax::Actors::LeaseActor.new(curation_concern).destroy
|
18
|
-
flash[:notice] = curation_concern
|
19
|
-
if curation_concern.work? && curation_concern
|
18
|
+
flash[:notice] = lease_history(curation_concern)&.last
|
19
|
+
if curation_concern.work? && work_has_file_set_members?(curation_concern)
|
20
20
|
redirect_to confirm_permission_path
|
21
21
|
else
|
22
22
|
redirect_to edit_lease_path
|
@@ -51,10 +51,19 @@ module Hyrax
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def edit
|
54
|
+
@curation_concern = Hyrax::Forms::WorkLeaseForm.new(curation_concern).prepopulate! if
|
55
|
+
Hyrax.config.use_valkyrie?
|
54
56
|
add_breadcrumb t(:'hyrax.controls.home'), root_path
|
55
57
|
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
|
56
58
|
add_breadcrumb t(:'hyrax.leases.index.manage_leases'), hyrax.leases_path
|
57
59
|
add_breadcrumb t(:'hyrax.leases.edit.lease_update'), '#'
|
58
60
|
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def lease_history(concern)
|
65
|
+
concern.try(:lease_history) ||
|
66
|
+
concern.try(:lease)&.lease_history
|
67
|
+
end
|
59
68
|
end
|
60
69
|
end
|
@@ -6,7 +6,8 @@ module Hyrax
|
|
6
6
|
included do
|
7
7
|
attr_accessor :curation_concern
|
8
8
|
helper_method :curation_concern
|
9
|
-
|
9
|
+
base_class = Hyrax.config.use_valkyrie? ? Hyrax::Resource : ActiveFedora::Base
|
10
|
+
load_and_authorize_resource class: base_class, instance_name: :curation_concern, except: [:index]
|
10
11
|
end
|
11
12
|
|
12
13
|
# This is an override of Hyrax::ApplicationController
|
@@ -15,5 +16,16 @@ module Hyrax
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def edit; end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def work_has_file_set_members?(work)
|
23
|
+
case work
|
24
|
+
when Valkyrie::Resource
|
25
|
+
Hyrax.custom_queries.find_child_file_set_ids(resource: work).any?
|
26
|
+
else
|
27
|
+
work.file_sets.present?
|
28
|
+
end
|
29
|
+
end
|
18
30
|
end
|
19
31
|
end
|
@@ -5,7 +5,7 @@ module Hyrax
|
|
5
5
|
class CollectionReportsController < AnalyticsController
|
6
6
|
include Hyrax::BreadcrumbsForCollectionAnalytics
|
7
7
|
def index
|
8
|
-
return unless Hyrax.config.analytics?
|
8
|
+
return unless Hyrax.config.analytics? && Hyrax.config.analytics_provider != 'ga4'
|
9
9
|
|
10
10
|
@pageviews = Hyrax::Analytics.daily_events('collection-page-view')
|
11
11
|
@work_page_views = Hyrax::Analytics.daily_events('work-in-collection-view')
|
@@ -21,7 +21,7 @@ module Hyrax
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def show
|
24
|
-
return unless Hyrax.config.analytics?
|
24
|
+
return unless Hyrax.config.analytics? && Hyrax.config.analytics_provider != 'ga4'
|
25
25
|
@document = ::SolrDocument.find(params[:id])
|
26
26
|
@pageviews = Hyrax::Analytics.daily_events_for_id(@document.id, 'collection-page-view')
|
27
27
|
@work_page_views = Hyrax::Analytics.daily_events_for_id(@document.id, 'work-in-collection-view')
|
@@ -6,7 +6,7 @@ module Hyrax
|
|
6
6
|
include Hyrax::BreadcrumbsForWorksAnalytics
|
7
7
|
|
8
8
|
def index
|
9
|
-
return unless Hyrax.config.analytics?
|
9
|
+
return unless Hyrax.config.analytics? && Hyrax.config.analytics_provider != 'ga4'
|
10
10
|
|
11
11
|
@accessible_works ||= accessible_works
|
12
12
|
@accessible_file_sets ||= accessible_file_sets
|
@@ -15,9 +15,8 @@ module Hyrax
|
|
15
15
|
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
|
16
16
|
add_breadcrumb t(:'hyrax.admin.sidebar.tasks'), '#'
|
17
17
|
add_breadcrumb t(:'hyrax.admin.sidebar.workflow_review'), request.path
|
18
|
-
|
19
|
-
@
|
20
|
-
@published_list = actionable_objects.select(&:published?)
|
18
|
+
assign_action_objects_params
|
19
|
+
@response = WorkflowResponse.new(actionable_objects.to_a, actionable_objects.total_count, current_page, per_page, under_review?)
|
21
20
|
end
|
22
21
|
|
23
22
|
private
|
@@ -30,5 +29,51 @@ module Hyrax
|
|
30
29
|
@actionable_objects ||=
|
31
30
|
Hyrax::Workflow::ActionableObjects.new(user: current_user)
|
32
31
|
end
|
32
|
+
|
33
|
+
def current_page
|
34
|
+
@page ||= params.fetch('page', 1).to_i
|
35
|
+
end
|
36
|
+
|
37
|
+
def per_page
|
38
|
+
@per_page ||= params.fetch('per_page', 10).to_i
|
39
|
+
end
|
40
|
+
|
41
|
+
def assign_action_objects_params
|
42
|
+
actionable_objects.page = current_page
|
43
|
+
actionable_objects.per_page = per_page
|
44
|
+
actionable_objects.workflow_state_filter = (under_review? ? '!' : '') + deposited_workflow_state_name
|
45
|
+
end
|
46
|
+
|
47
|
+
def under_review?
|
48
|
+
@under_review = params['state'] != 'published'
|
49
|
+
end
|
50
|
+
|
51
|
+
class WorkflowResponse
|
52
|
+
attr_reader :total_count
|
53
|
+
attr_reader :current_page
|
54
|
+
attr_reader :per_page
|
55
|
+
attr_reader :docs
|
56
|
+
attr_reader :under_review
|
57
|
+
|
58
|
+
def initialize(docs, total_count, page, per_page, under_review)
|
59
|
+
@docs = docs
|
60
|
+
@total_count = total_count
|
61
|
+
@per_page = per_page.to_i
|
62
|
+
@current_page = page.to_i
|
63
|
+
@under_review = under_review
|
64
|
+
end
|
65
|
+
|
66
|
+
def total_pages
|
67
|
+
(total_count.to_f / per_page).ceil
|
68
|
+
end
|
69
|
+
|
70
|
+
def limit_value
|
71
|
+
docs.length
|
72
|
+
end
|
73
|
+
|
74
|
+
def viewing_under_review?
|
75
|
+
under_review
|
76
|
+
end
|
77
|
+
end
|
33
78
|
end
|
34
79
|
end
|
@@ -220,7 +220,7 @@ module Hyrax
|
|
220
220
|
|
221
221
|
@collection.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE unless @collection.discoverable?
|
222
222
|
# we don't have to reindex the full graph when updating collection
|
223
|
-
@collection.reindex_extent
|
223
|
+
@collection.try(:reindex_extent=, Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX)
|
224
224
|
if @collection.update(collection_params.except(:members))
|
225
225
|
after_update_response
|
226
226
|
else
|
@@ -422,7 +422,6 @@ module Hyrax
|
|
422
422
|
params.permit(collection: {})[:collection]
|
423
423
|
.merge(params.permit(:collection_type_gid)
|
424
424
|
.with_defaults(collection_type_gid: default_collection_type_gid))
|
425
|
-
.merge(member_of_collection_ids: Array(params[:parent_id]))
|
426
425
|
end
|
427
426
|
end
|
428
427
|
|
@@ -3,6 +3,7 @@ module Hyrax
|
|
3
3
|
class DownloadsController < ApplicationController
|
4
4
|
include Hydra::Controller::DownloadBehavior
|
5
5
|
include Hyrax::LocalFileDownloadsControllerBehavior
|
6
|
+
include Hyrax::WorkflowsHelper # Provides #workflow_restriction?
|
6
7
|
|
7
8
|
def self.default_content_path
|
8
9
|
:original_file
|
@@ -37,12 +38,26 @@ module Hyrax
|
|
37
38
|
{ type: mime_type_for(file), disposition: 'inline' }
|
38
39
|
end
|
39
40
|
|
41
|
+
def file_set_parent(file_set_id)
|
42
|
+
file_set = Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: file_set_id, use_valkyrie: Hyrax.config.use_valkyrie?)
|
43
|
+
@parent ||=
|
44
|
+
case file_set
|
45
|
+
when Hyrax::Resource
|
46
|
+
Hyrax.query_service.find_parents(resource: file_set).first
|
47
|
+
else
|
48
|
+
file_set.parent
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
40
52
|
# Customize the :read ability in your Ability class, or override this method.
|
41
53
|
# Hydra::Ability#download_permissions can't be used in this case because it assumes
|
42
54
|
# that files are in a LDP basic container, and thus, included in the asset's uri.
|
43
55
|
def authorize_download!
|
44
56
|
authorize! :download, params[asset_param_key]
|
45
|
-
|
57
|
+
# Deny access if the work containing this file is restricted by a workflow
|
58
|
+
return unless workflow_restriction?(file_set_parent(params[asset_param_key]), ability: current_ability)
|
59
|
+
raise Hyrax::WorkflowAuthorizationException
|
60
|
+
rescue CanCan::AccessDenied, Hyrax::WorkflowAuthorizationException
|
46
61
|
unauthorized_image = Rails.root.join("app", "assets", "images", "unauthorized.png")
|
47
62
|
send_file unauthorized_image, status: :unauthorized
|
48
63
|
end
|
@@ -10,6 +10,7 @@ module Hyrax
|
|
10
10
|
before_action :authenticate_user!, except: [:show, :citation, :stats]
|
11
11
|
load_and_authorize_resource class: ::FileSet, except: :show
|
12
12
|
before_action :build_breadcrumbs, only: [:show, :edit, :stats]
|
13
|
+
before_action :presenter
|
13
14
|
|
14
15
|
# provides the help_text view method
|
15
16
|
helper PermissionsHelper
|
@@ -191,7 +192,15 @@ module Hyrax
|
|
191
192
|
def initialize_edit_form
|
192
193
|
guard_for_workflow_restriction_on!(parent: parent)
|
193
194
|
|
194
|
-
|
195
|
+
case file_set
|
196
|
+
when Hyrax::Resource
|
197
|
+
@form = Hyrax::Forms::ResourceForm.for(file_set)
|
198
|
+
@form.prepopulate!
|
199
|
+
else
|
200
|
+
@form = form_class.new(file_set)
|
201
|
+
@form[:visibility] = file_set.visibility # workaround for hydra-head < 12
|
202
|
+
end
|
203
|
+
@version_list = Hyrax::VersionListPresenter.for(file_set: file_set)
|
195
204
|
@groups = current_user.groups
|
196
205
|
end
|
197
206
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Hyrax
|
3
3
|
class PermissionsController < ApplicationController
|
4
|
-
load_resource class:
|
4
|
+
load_resource class: Hyrax::Resource, instance_name: :curation_concern
|
5
5
|
|
6
6
|
attr_reader :curation_concern
|
7
7
|
helper_method :curation_concern
|
@@ -23,7 +23,6 @@ module Hyrax
|
|
23
23
|
add_breadcrumb t(:'hyrax.controls.home'), root_path
|
24
24
|
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
|
25
25
|
add_breadcrumb t(:'hyrax.transfers.new.header'), hyrax.new_work_transfer_path
|
26
|
-
@work = Hyrax::WorkRelation.new.find(params[:id])
|
27
26
|
end
|
28
27
|
|
29
28
|
def create
|
@@ -31,7 +30,6 @@ module Hyrax
|
|
31
30
|
if @proxy_deposit_request.save
|
32
31
|
redirect_to hyrax.transfers_path, notice: "Transfer request created"
|
33
32
|
else
|
34
|
-
@work = Hyrax::WorkRelation.new.find(params[:id])
|
35
33
|
render :new
|
36
34
|
end
|
37
35
|
end
|
@@ -9,7 +9,8 @@ module Hyrax
|
|
9
9
|
# @return [Hyrax::Resource]
|
10
10
|
attr_reader :curation_concern
|
11
11
|
|
12
|
-
|
12
|
+
resource_klass = Hyrax.config.use_valkyrie? ? Hyrax::Resource : ActiveFedora::Base
|
13
|
+
load_resource class: resource_klass, instance_name: :curation_concern
|
13
14
|
before_action :authenticate_user!
|
14
15
|
|
15
16
|
def update
|
@@ -39,7 +40,7 @@ module Hyrax
|
|
39
40
|
|
40
41
|
def after_update_response
|
41
42
|
respond_to do |wants|
|
42
|
-
wants.html { redirect_to [main_app, curation_concern], notice: "The #{curation_concern.human_readable_type} has been updated." }
|
43
|
+
wants.html { redirect_to [main_app, curation_concern], notice: "The #{curation_concern.class.human_readable_type} has been updated." }
|
43
44
|
wants.json { render 'hyrax/base/show', status: :ok, location: polymorphic_path([main_app, curation_concern]) }
|
44
45
|
end
|
45
46
|
end
|
@@ -109,7 +109,9 @@ module Hyrax
|
|
109
109
|
# needed to make the determination are too expensive to do for every possible
|
110
110
|
# collection, so we only test for this situation prior to saving the new
|
111
111
|
# relationship.
|
112
|
+
# note: the graph indexer does not care about nesting depth
|
112
113
|
def nesting_within_maximum_depth
|
114
|
+
return true if Hyrax.config.use_solr_graph_for_collection_nesting
|
113
115
|
return true if query_service.valid_combined_nesting_depth?(parent: parent, child: child, scope: context)
|
114
116
|
errors.add(:collection, :exceeds_maximum_nesting_depth)
|
115
117
|
false
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Hyrax
|
3
|
+
module Forms
|
4
|
+
##
|
5
|
+
# Nested form for embargos.
|
6
|
+
class Embargo < Hyrax::ChangeSet
|
7
|
+
property :visibility_after_embargo
|
8
|
+
property :visibility_during_embargo
|
9
|
+
property :embargo_release_date
|
10
|
+
property :embargo_history, default: []
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -4,7 +4,7 @@ module Hyrax::Forms
|
|
4
4
|
include HydraEditor::Form
|
5
5
|
include HydraEditor::Form::Permissions
|
6
6
|
|
7
|
-
delegate :depositor, :permissions, to: :model
|
7
|
+
delegate :depositor, :permissions, :human_readable_type, to: :model
|
8
8
|
|
9
9
|
self.required_fields = [:title, :creator, :license]
|
10
10
|
|