hyrax 4.0.0.beta2 → 4.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +66 -54
- data/.dassie/Gemfile +1 -1
- data/.dassie/app/controllers/catalog_controller.rb +1 -1
- data/.dassie/config/initializers/hyrax.rb +4 -0
- data/.github/SUPPORT.md +2 -3
- data/.github/workflows/main.yml +4 -4
- data/.github/workflows/release.yml +10 -4
- data/.koppie/Gemfile +1 -2
- data/.koppie/app/controllers/catalog_controller.rb +1 -1
- data/.koppie/config/authorities/licenses.yml +7 -7
- data/.koppie/config/initializers/file_services.rb +4 -0
- data/.koppie/db/schema.rb +2 -2
- data/.koppie/yarn.lock +1 -1
- data/CONTAINERS.md +2 -2
- data/CONTRIBUTING.md +2 -2
- data/Dockerfile +21 -9
- data/README.md +24 -97
- data/app/assets/stylesheets/hyrax/_catalog.scss +4 -0
- data/app/assets/stylesheets/hyrax/_forms.scss +4 -0
- data/app/controllers/concerns/hyrax/controller.rb +1 -23
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +1 -0
- data/app/controllers/hyrax/dashboard/collections_controller.rb +1 -1
- data/app/controllers/hyrax/downloads_controller.rb +16 -1
- data/app/controllers/hyrax/file_sets_controller.rb +9 -2
- data/app/controllers/hyrax/my/works_controller.rb +3 -1
- data/app/controllers/hyrax/transfers_controller.rb +4 -1
- data/app/controllers/hyrax/workflow_actions_controller.rb +3 -2
- 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/pcdm_object_form.rb +46 -0
- data/app/forms/hyrax/forms/resource_form.rb +9 -34
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +1 -1
- data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +1 -1
- data/app/jobs/characterize_job.rb +3 -2
- data/app/jobs/valkyrie_create_derivatives_job.rb +0 -2
- data/app/models/concerns/hyrax/ability.rb +1 -1
- data/app/models/concerns/hyrax/collection_behavior.rb +0 -47
- data/app/models/concerns/hyrax/solr_document/metadata.rb +1 -0
- data/app/models/concerns/hyrax/suppressible.rb +0 -8
- data/app/models/file_download_stat.rb +4 -4
- data/app/models/hyrax/collection_type.rb +0 -16
- data/app/models/hyrax/file_metadata.rb +5 -12
- data/app/models/hyrax/file_set.rb +1 -9
- data/app/models/hyrax/statistic.rb +4 -4
- data/app/models/sipity.rb +27 -6
- data/app/presenters/hyrax/collection_presenter.rb +1 -1
- data/app/presenters/hyrax/iiif_manifest_presenter.rb +14 -4
- data/app/presenters/hyrax/work_show_presenter.rb +1 -1
- data/app/presenters/hyrax/workflow_presenter.rb +1 -1
- data/app/search_builders/hyrax/collection_search_builder.rb +1 -0
- data/app/search_builders/hyrax/filter_suppressed_with_roles.rb +1 -1
- data/app/services/hyrax/admin_set_service.rb +1 -1
- data/app/services/hyrax/collections/nested_collection_query_service.rb +2 -2
- data/app/services/hyrax/database_migrator.rb +1 -1
- data/app/services/hyrax/edit_permissions_service.rb +21 -3
- data/app/services/hyrax/restriction_service.rb +1 -1
- data/app/services/hyrax/solr_query_service.rb +10 -2
- data/app/services/hyrax/solr_service.rb +22 -16
- data/app/services/hyrax/thumbnail_path_service.rb +10 -2
- data/app/services/hyrax/valkyrie_persist_derivatives.rb +26 -15
- data/app/services/hyrax/valkyrie_upload.rb +23 -30
- data/app/services/hyrax/visibility_propagator.rb +5 -5
- data/app/services/hyrax/workflow/status_list_service.rb +1 -1
- data/app/views/hyrax/base/_attribute_rows.html.erb +2 -0
- data/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb +1 -1
- data/app/views/hyrax/file_sets/_permission.html.erb +1 -1
- data/app/views/hyrax/file_sets/edit.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_audio.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_image.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_office_document.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_pdf.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_video.html.erb +1 -1
- data/app/views/hyrax/uploads/_js_templates.html.erb +8 -8
- data/app/views/hyrax/uploads/_js_templates_branding.html.erb +2 -2
- data/app/views/hyrax/users/_vitals.html.erb +4 -4
- data/chart/hyrax/Chart.yaml +7 -7
- data/chart/hyrax/README.md +5 -0
- data/chart/hyrax/templates/_helpers.tpl +14 -6
- data/chart/hyrax/templates/cron-embargo.yaml +1 -1
- data/chart/hyrax/templates/cron-lease.yaml +1 -1
- data/chart/hyrax/templates/deployment-worker.yaml +2 -2
- data/chart/hyrax/templates/extra-list.yaml +8 -0
- data/chart/hyrax/templates/secrets.yaml +3 -3
- data/chart/hyrax/values.yaml +22 -15
- data/config/locales/hyrax.de.yml +7 -7
- data/config/locales/hyrax.es.yml +7 -7
- data/config/locales/hyrax.fr.yml +8 -8
- data/config/locales/hyrax.it.yml +7 -7
- data/config/locales/hyrax.pt-BR.yml +7 -7
- data/config/locales/hyrax.zh.yml +8 -8
- data/config/metadata/file_set_metadata.yaml +130 -0
- data/documentation/MAINTENANCE.md +77 -0
- data/documentation/developing-your-hyrax-based-app.md +2 -2
- data/documentation/legacyREADME.md +2 -2
- data/hyrax.gemspec +4 -4
- data/lib/generators/hyrax/templates/catalog_controller.rb +1 -1
- data/lib/hyrax/configuration.rb +5 -0
- data/lib/hyrax/engine.rb +0 -1
- data/lib/hyrax/transactions/container.rb +0 -2
- data/lib/hyrax/transactions/steps/save_collection_banner.rb +1 -1
- data/lib/hyrax/transactions/steps/save_collection_logo.rb +1 -1
- data/lib/hyrax/version.rb +1 -1
- data/lib/valkyrie/indexing/solr/indexing_adapter.rb +1 -1
- data/lib/wings/active_fedora_converter/file_metadata_node.rb +1 -1
- data/samvera-fall-TM3.svg +376 -0
- data/template.rb +1 -1
- metadata +36 -45
- data/app/conversions/power_converters/polymorphic_type.rb +0 -9
- data/app/conversions/power_converters/sipity_action.rb +0 -11
- data/app/conversions/power_converters/sipity_action_name.rb +0 -10
- data/app/conversions/power_converters/sipity_agent.rb +0 -9
- data/app/conversions/power_converters/sipity_entity.rb +0 -14
- data/app/conversions/power_converters/sipity_role.rb +0 -10
- data/app/conversions/power_converters/sipity_workflow_id.rb +0 -17
- data/app/conversions/power_converters/sipity_workflow_state.rb +0 -13
- data/app/conversions/power_converters.rb +0 -7
data/README.md
CHANGED
@@ -11,25 +11,19 @@ Docs: [![Documentation Status](https://inch-ci.org/github/samvera/hyrax.svg?bran
|
|
11
11
|
[![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./.github/CONTRIBUTING.md)
|
12
12
|
[![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
|
13
13
|
|
14
|
-
Jump in: [![Slack
|
14
|
+
Jump in: [![Samvera Community Slack](https://img.shields.io/badge/samvera-slack-blueviolet)](https://samvera.slack.com/)
|
15
15
|
|
16
16
|
## Table of Contents
|
17
17
|
|
18
18
|
* [What is Hyrax?](#what-is-hyrax)
|
19
|
-
* [
|
20
|
-
* [
|
21
|
-
* [
|
22
|
-
* [
|
23
|
-
|
24
|
-
* [Contributing](#contributing)
|
25
|
-
* [Release process](#release-process)
|
26
|
-
* [Developing your Hyrax\-based Application](#developing-your-hyrax-based-application)
|
27
|
-
* [Deploying your Hyrax\-based Application to production](#deploying-your-hyrax-based-application-to-production)
|
19
|
+
* [Getting Help and Asking Questions](#getting-help-and-asking-questions)
|
20
|
+
* [How to Run the Code](#how-to-run-the-code)
|
21
|
+
* [Contribute](#contribute)
|
22
|
+
* [Release Process](#release-process)
|
23
|
+
* [Deploy](#deploy)
|
28
24
|
* [Acknowledgments](#acknowledgments)
|
29
25
|
* [License](#license)
|
30
26
|
|
31
|
-
<aside>Table of contents created by <a href="https://github.com/ekalinin/github-markdown-toc.go">gh-md-toc</a></aside>
|
32
|
-
|
33
27
|
## What is Hyrax?
|
34
28
|
|
35
29
|
Hyrax is a [Ruby on Rails Engine](https://guides.rubyonrails.org/engines.html) built by the [Samvera community](https://samvera.org). Hyrax provides a foundation for creating many different digital repository applications.
|
@@ -44,112 +38,45 @@ Hyrax offers the ability to:
|
|
44
38
|
* Enable/disable optional features via an administrative dashboard
|
45
39
|
* And more (https://hyrax.samvera.org/about/)
|
46
40
|
|
47
|
-
##
|
48
|
-
|
49
|
-
* List of features: [Feature Matrix](https://github.com/samvera/hyrax/wiki/Feature-matrix)
|
50
|
-
* Configuration and enabling features: [Hyrax Management Guide](https://github.com/samvera/hyrax/wiki/Hyrax-Management-Guide)
|
51
|
-
* Walk-through on using features: [Hyrax Feature Guides](https://samvera.github.io/intro-to.html)
|
52
|
-
* [Entity Relationship Diagram](./artifacts/entity-relationship-diagram.pdf)
|
53
|
-
* For general information about Hyrax: [Hyrax Site](https://hyrax.samvera.org/)
|
54
|
-
* A note about [versions of Hyrax](./documentation/note-about-versions.md)
|
55
|
-
|
56
|
-
## Support Policies
|
57
|
-
|
58
|
-
* Hyrax 3.x supports the latest browser versions for Chrome, Firefox, Edge, and Safari.
|
59
|
-
|
60
|
-
## Help
|
61
|
-
|
62
|
-
The Samvera community is here to help. Please see our [support guide](./.github/SUPPORT.md).
|
63
|
-
|
64
|
-
## Working with Hyrax
|
65
|
-
|
66
|
-
There are two primary Hyrax development concerns:
|
67
|
-
|
68
|
-
1. Developing the Hyrax engine
|
69
|
-
2. Developing your Hyrax-based Application
|
70
|
-
|
71
|
-
### Developing the Hyrax Engine
|
72
|
-
|
73
|
-
This is where you work on the code-base that will be used by yours and other Hyrax-based applications. We recommend using [Docker and Hyrax's engine development containers](./CONTAINERS.md).
|
41
|
+
## Getting Help and Asking Questions
|
74
42
|
|
75
|
-
|
76
|
-
<p><em><strong>Note:</em></strong> This is not the only path for Hyrax-engine development. In the past, <a href="./documentation/legacyREADME.md">we documented extensive steps</a> to install the various dependencies for Hyrax-engine development. There is also a <a href="https://github.com/samvera/hyrax/wiki/Hyrax-Development-Guide#quick-start-for-hyrax-development">Quick Start for Hyrax engine development</a> that outlines steps for working on the Hyrax engine.</p>
|
77
|
-
<p>By moving to Docker, we are encoding the documentation steps for standing up a Hyrax-engine development environment.</p>
|
78
|
-
</aside>
|
43
|
+
More detailed documentation about Hyrax is available on the [Hyrax Github Wiki](https://github.com/samvera/hyrax/wiki) but if you have questions or need help, please email the [Samvera community tech list](https://samvera.atlassian.net/wiki/spaces/samvera/pages/1171226735/Samvera+Community+Email+Lists#Samvera-Tech-(15-20-messages-per-week-on-average)) or stop by the #dev channel in the [Samvera community Slack team](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405211682/Getting+Started+in+the+Samvera+Community#Join-the-Samvera-Slack-workspace). You can also get in touch with the [Hyrax Maintenance Working Group](https://samvera.atlassian.net/wiki/spaces/samvera/pages/496632295/Hyrax+Maintenance+Working+Group), including the Hyrax Product Owner and Hyrax Tech Lead.
|
79
44
|
|
80
|
-
|
45
|
+
[Reporting Issues](./.github/SUPPORT.md)
|
81
46
|
|
82
|
-
|
47
|
+
## How to Run the Code
|
83
48
|
|
84
|
-
|
49
|
+
[Run Hyrax Locally Using Docker](./CONTAINERS.md)
|
85
50
|
|
86
|
-
|
51
|
+
Hyrax can also work running prerequisite dependencies separately. The following describe ways to do this:
|
52
|
+
* [Developing Your Hyrax-based Application](./documentation/developing-your-hyrax-based-app.md)
|
53
|
+
* [Development setup using Engine Cart and Solr Fedora wrapper](https://github.com/samvera/hyrax/wiki/Development-setup-using-Engine-Cart-and-Solr---Fedora-wrapper)
|
87
54
|
|
88
|
-
|
89
|
-
HYRAX_ANALYTICS=true
|
90
|
-
HYRAX_ANALYTICS_PROVIDER=google
|
91
|
-
ANALYTICS_START_DATE=2021-08-21
|
92
|
-
```
|
55
|
+
## Contribute
|
93
56
|
|
94
|
-
|
57
|
+
We'd love to accept your contributions. Please see our [guide to contributing to Hyrax](./.github/CONTRIBUTING.md).
|
95
58
|
|
96
|
-
|
97
|
-
GOOGLE_ANALYTICS_ID=UA-111111-1 # Universal ID (Currently Hyrax Analytics only works with Univeral (UA) accounts)
|
98
|
-
GOOGLE_OAUTH_APP_NAME=
|
99
|
-
GOOGLE_OAUTHAPP_VERSION=
|
100
|
-
GOOGLE_OAUTH_PRIVATE_KEY_PATH= # store the .p12 file in the root of your application
|
101
|
-
GOOGLE_OAUTH_PRIVATE_KEY_SECRET=
|
102
|
-
GOOGLE_OAUTH_CLIENT_EMAIL=
|
103
|
-
```
|
59
|
+
[Installing Analytics](https://github.com/samvera/hyrax/wiki/Hyrax-Management-Guide#installing-analytics)
|
104
60
|
|
105
|
-
|
106
|
-
|
107
|
-
```
|
108
|
-
MATOMO_SITE_ID=
|
109
|
-
MATOMO_BASE_URL=
|
110
|
-
MATOMO_AUTH_TOKEN=
|
111
|
-
```
|
112
|
-
|
113
|
-
#### Analytics Features
|
114
|
-
|
115
|
-
Once analytics is enabled, Hyrax will automatically install the JS tracking code. Page views and downloads of a file set are recorded and sent to the selected analytics provider. Admin users will have access to an expanded dashboard with details about how many vistors viewed a page, and how many visitors downloaded a file. Easily find the top works by views, and most popular file downloads!
|
116
|
-
|
117
|
-
#### Contributing
|
118
|
-
|
119
|
-
We'd love to accept your contributions. Please see our guide to [contributing to Hyrax](./.github/CONTRIBUTING.md).
|
120
|
-
|
121
|
-
Here are possible ways to help:
|
122
|
-
|
123
|
-
* The Hyrax user interface is translated into a number of languages, and many of these translations come from Google Translate. If you are a native or fluent speaker of a non-English language, your help improving these translations are most welcome. (Hyrax currently supports English, Spanish, Chinese, Italian, German, French, and Portuguese.)
|
124
|
-
* Do you see English in the application where you would expect to see one of the languages above? If so, [file an issue](https://github.com/samvera/hyrax/issues/new) and suggest a translation, please.
|
125
|
-
* [Contribute a user story](https://github.com/samvera/hyrax/issues/new).
|
126
|
-
* Help us improve [Hyrax's test coverage](https://coveralls.io/r/samvera/hyrax) or [documentation coverage](https://inch-ci.org/github/samvera/hyrax).
|
127
|
-
* Refactor away [code smells](https://codeclimate.com/github/samvera/hyrax).
|
128
|
-
|
129
|
-
#### Release process
|
61
|
+
## Release Process
|
130
62
|
|
131
63
|
See the [release management process](https://github.com/samvera/hyrax/wiki/Release-management-process).
|
132
64
|
|
133
|
-
|
134
|
-
|
135
|
-
For those familiar with Rails, this is where you create your own application (via `rails new`) and add Hyrax as a gem to your `Gemfile`. Your Hyrax-based application is the place for you to create features specific to your Hyrax-based application.
|
65
|
+
We also have a [Maintenance Policy](./documentation/MAINTENANCE.md).
|
136
66
|
|
137
|
-
|
138
|
-
|
139
|
-
### Deploying your Hyrax-based Application to production
|
67
|
+
## Deploy
|
140
68
|
|
141
69
|
Steps to deploy a Hyrax-based application to production will vary depending on your particular ecosystem but here are some methods and things to consider:
|
142
|
-
|
143
|
-
|
144
|
-
* [Helm Chart](./CONTAINERS.md#deploying-to-production) (for cloud-based Kubernetes-style deployments)
|
70
|
+
* [Hyrax Management Guide](https://github.com/samvera/hyrax/wiki/Hyrax-Management-Guide) (provides guidance for things to keep in mind in production environments)
|
71
|
+
* [Helm Chart to deploy Hyrax-based application](./CONTAINERS.md#deploying-to-production) (for cloud-based Kubernetes-style deployments)
|
145
72
|
|
146
73
|
## Acknowledgments
|
147
74
|
|
148
75
|
This software has been developed by and is brought to you by the Samvera community. Learn more at the
|
149
76
|
[Samvera website](http://samvera.org/).
|
150
77
|
|
151
|
-
![Samvera Logo](
|
78
|
+
![Samvera Logo](./samvera-fall-TM3.svg)
|
152
79
|
|
153
80
|
## License
|
154
81
|
|
155
|
-
Hyrax is available under [the Apache 2.0 license](LICENSE).
|
82
|
+
Hyrax is available under [the Apache 2.0 license](LICENSE).
|
@@ -32,28 +32,6 @@ module Hyrax::Controller
|
|
32
32
|
super.merge(locale: I18n.locale)
|
33
33
|
end
|
34
34
|
|
35
|
-
##
|
36
|
-
# @deprecated provides short-term compatibility with Blacklight 6
|
37
|
-
# @return [Class<Blacklight::SearchBuilder>]
|
38
|
-
def search_builder_class
|
39
|
-
return super if defined?(super)
|
40
|
-
Deprecation.warn("Avoid direct calls to `#search_builder_class`; this" \
|
41
|
-
" method provides short-term compatibility to" \
|
42
|
-
" Blacklight 6 clients.")
|
43
|
-
blacklight_config.search_builder_class
|
44
|
-
end
|
45
|
-
|
46
|
-
##
|
47
|
-
# @deprecated provides short-term compatibility with Blacklight 6
|
48
|
-
# @return [Blacklight::AbstractRepository]
|
49
|
-
def repository
|
50
|
-
return super if defined?(super)
|
51
|
-
Deprecation.warn("Avoid direct calls to `#repository`; this method" \
|
52
|
-
" provides short-term compatibility to Blacklight 6 " \
|
53
|
-
" clients.")
|
54
|
-
blacklight_config.repository
|
55
|
-
end
|
56
|
-
|
57
35
|
# @note for Blacklight 6/7 compatibility
|
58
36
|
def search_results(*args)
|
59
37
|
return super if defined?(super) # use the upstream if present (e.g. in BL 6)
|
@@ -69,7 +47,7 @@ module Hyrax::Controller
|
|
69
47
|
search_service_class.new(config: blacklight_config,
|
70
48
|
scope: self,
|
71
49
|
user_params: search_params,
|
72
|
-
search_builder_class: search_builder_class)
|
50
|
+
search_builder_class: blacklight_config.search_builder_class)
|
73
51
|
end
|
74
52
|
|
75
53
|
private
|
@@ -13,6 +13,7 @@ module Hyrax
|
|
13
13
|
|
14
14
|
before_action do
|
15
15
|
blacklight_config.track_search_session = false
|
16
|
+
blacklight_config.search_builder_class = search_builder_class
|
16
17
|
end
|
17
18
|
|
18
19
|
class_attribute :_curation_concern_type, :show_presenter, :work_form_service, :search_builder_class
|
@@ -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
|
@@ -195,7 +195,14 @@ module Hyrax
|
|
195
195
|
def initialize_edit_form
|
196
196
|
guard_for_workflow_restriction_on!(parent: parent)
|
197
197
|
|
198
|
-
|
198
|
+
case file_set
|
199
|
+
when Hyrax::Resource
|
200
|
+
@form = Hyrax::Forms::ResourceForm.for(file_set)
|
201
|
+
@form.prepopulate!
|
202
|
+
else
|
203
|
+
@form = form_class.new(file_set)
|
204
|
+
end
|
205
|
+
@version_list = Hyrax::VersionListPresenter.for(file_set: file_set)
|
199
206
|
@groups = current_user.groups
|
200
207
|
end
|
201
208
|
|
@@ -236,7 +243,7 @@ module Hyrax
|
|
236
243
|
end
|
237
244
|
|
238
245
|
def single_item_search_service
|
239
|
-
Hyrax::SearchService.new(config: blacklight_config, user_params: params.except(:q, :page), scope: self, search_builder_class: search_builder_class)
|
246
|
+
Hyrax::SearchService.new(config: blacklight_config, user_params: params.except(:q, :page), scope: self, search_builder_class: blacklight_config.search_builder_class)
|
240
247
|
end
|
241
248
|
|
242
249
|
def wants_to_revert?
|
@@ -45,7 +45,10 @@ module Hyrax
|
|
45
45
|
# any existing edit permissions on the work.
|
46
46
|
def accept
|
47
47
|
@proxy_deposit_request.transfer!(params[:reset])
|
48
|
-
|
48
|
+
if params[:sticky]
|
49
|
+
current_user.can_receive_deposits_from << @proxy_deposit_request.sending_user unless
|
50
|
+
current_user.can_receive_deposits_from.include? @proxy_deposit_request.sending_user
|
51
|
+
end
|
49
52
|
redirect_to hyrax.transfers_path, notice: "Transfer complete"
|
50
53
|
end
|
51
54
|
|
@@ -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
|
@@ -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
|
|
@@ -3,44 +3,17 @@
|
|
3
3
|
module Hyrax
|
4
4
|
module Forms
|
5
5
|
##
|
6
|
-
#
|
7
|
-
class FileSetForm < Hyrax::
|
6
|
+
# A form for +Hyrax::FileSet+s.
|
7
|
+
class FileSetForm < Hyrax::Forms::ResourceForm
|
8
8
|
include Hyrax::FormFields(:core_metadata)
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
definitions
|
15
|
-
.select { |_, definition| definition[:required] }
|
16
|
-
.keys.map(&:to_sym)
|
17
|
-
end
|
18
|
-
end
|
10
|
+
# The fields in +:file_set_metadata+ were hardcoded into this form in a
|
11
|
+
# previous version of Hyrax, but ideally in the future this metadata will
|
12
|
+
# be configurable.
|
13
|
+
include Hyrax::FormFields(:file_set_metadata)
|
19
14
|
|
20
|
-
property :
|
21
|
-
property :
|
22
|
-
|
23
|
-
property :based_near
|
24
|
-
property :contributor
|
25
|
-
property :date_created
|
26
|
-
property :description
|
27
|
-
property :identifier
|
28
|
-
property :keyword
|
29
|
-
property :language
|
30
|
-
property :publisher
|
31
|
-
property :related_url
|
32
|
-
property :subject
|
33
|
-
|
34
|
-
property :permissions, virtual: true
|
35
|
-
property :visibility, default: VisibilityIntention::PRIVATE
|
36
|
-
|
37
|
-
# virtual properties for embargo/lease;
|
38
|
-
property :embargo_release_date, virtual: true
|
39
|
-
property :visibility_after_embargo, virtual: true
|
40
|
-
property :visibility_during_embargo, virtual: true
|
41
|
-
property :lease_expiration_date, virtual: true
|
42
|
-
property :visibility_after_lease, virtual: true
|
43
|
-
property :visibility_during_lease, virtual: true
|
15
|
+
property :representative_id, type: Valkyrie::Types::String
|
16
|
+
property :thumbnail_id, type: Valkyrie::Types::String
|
44
17
|
end
|
45
18
|
end
|
46
19
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hyrax
|
4
|
+
module Forms
|
5
|
+
##
|
6
|
+
# A form for PCDM objects: resources which have collection relationships and
|
7
|
+
# generally resemble +Hyrax::Work+.
|
8
|
+
class PcdmObjectForm < Hyrax::Forms::ResourceForm
|
9
|
+
include Hyrax::FormFields(:core_metadata)
|
10
|
+
|
11
|
+
property :on_behalf_of
|
12
|
+
property :proxy_depositor
|
13
|
+
|
14
|
+
# pcdm relationships
|
15
|
+
property :admin_set_id, prepopulator: ->(_opts) { self.admin_set_id = Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s }
|
16
|
+
property :member_ids, default: [], type: Valkyrie::Types::Array
|
17
|
+
property :member_of_collection_ids, default: [], type: Valkyrie::Types::Array
|
18
|
+
property :member_of_collections_attributes, virtual: true, populator: :in_collections_populator
|
19
|
+
validates_with CollectionMembershipValidator
|
20
|
+
|
21
|
+
property :representative_id, type: Valkyrie::Types::String
|
22
|
+
property :thumbnail_id, type: Valkyrie::Types::String
|
23
|
+
property :rendering_ids, default: [], type: Valkyrie::Types::Array
|
24
|
+
|
25
|
+
# backs the child work search element;
|
26
|
+
# @todo: look for a way for the view template not to depend on this
|
27
|
+
property :find_child_work, default: nil, virtual: true
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def in_collections_populator(fragment:, **_options)
|
32
|
+
adds = []
|
33
|
+
deletes = []
|
34
|
+
fragment.each do |_, h|
|
35
|
+
if h["_destroy"] == "true"
|
36
|
+
deletes << Valkyrie::ID.new(h["id"])
|
37
|
+
else
|
38
|
+
adds << Valkyrie::ID.new(h["id"])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
self.member_of_collection_ids = ((member_of_collection_ids + adds) - deletes).uniq
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -11,12 +11,16 @@ module Hyrax
|
|
11
11
|
# # other WorkForm-like configuration here
|
12
12
|
# end
|
13
13
|
#
|
14
|
+
# @note The returned class will extend +Hyrax::Forms::PcdmObjectForm+, not
|
15
|
+
# only +Hyrax::Forms::ResourceForm+. This is for backwards‐compatibility
|
16
|
+
# with existing Hyrax instances and satisfies the expected general use
|
17
|
+
# case (building forms for various PCDM object classes), but is *not*
|
18
|
+
# necessarily suitable for other kinds of Hyrax resource, like
|
19
|
+
# +Hyrax::FileSet+s.
|
14
20
|
def self.ResourceForm(work_class)
|
15
|
-
Class.new(Hyrax::Forms::
|
21
|
+
Class.new(Hyrax::Forms::PcdmObjectForm) do
|
16
22
|
self.model_class = work_class
|
17
23
|
|
18
|
-
include Hyrax::FormFields(:core_metadata)
|
19
|
-
|
20
24
|
##
|
21
25
|
# @return [String]
|
22
26
|
def self.inspect
|
@@ -29,7 +33,7 @@ module Hyrax
|
|
29
33
|
##
|
30
34
|
# @api public
|
31
35
|
#
|
32
|
-
# This form wraps
|
36
|
+
# This form wraps +Hyrax::ChangeSet+ in the +HydraEditor::Form+ interface.
|
33
37
|
class ResourceForm < Hyrax::ChangeSet # rubocop:disable Metrics/ClassLength
|
34
38
|
##
|
35
39
|
# @api private
|
@@ -69,8 +73,6 @@ module Hyrax
|
|
69
73
|
property :human_readable_type, writable: false
|
70
74
|
|
71
75
|
property :depositor
|
72
|
-
property :on_behalf_of
|
73
|
-
property :proxy_depositor
|
74
76
|
|
75
77
|
property :visibility, default: VisibilityIntention::PRIVATE, populator: :visibility_populator
|
76
78
|
|
@@ -97,17 +99,7 @@ module Hyrax
|
|
97
99
|
property :visibility_after_lease, virtual: true, prepopulator: ->(_opts) { self.visibility_after_lease = model.lease&.visibility_after_lease }
|
98
100
|
property :visibility_during_lease, virtual: true, prepopulator: ->(_opts) { self.visibility_during_lease = model.lease&.visibility_during_lease }
|
99
101
|
|
100
|
-
# pcdm relationships
|
101
|
-
property :admin_set_id, prepopulator: ->(_opts) { self.admin_set_id = Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s }
|
102
102
|
property :in_works_ids, virtual: true, prepopulator: InWorksPrepopulator
|
103
|
-
property :member_ids, default: [], type: Valkyrie::Types::Array
|
104
|
-
property :member_of_collection_ids, default: [], type: Valkyrie::Types::Array
|
105
|
-
property :member_of_collections_attributes, virtual: true, populator: :in_collections_populator
|
106
|
-
validates_with CollectionMembershipValidator
|
107
|
-
|
108
|
-
property :representative_id, type: Valkyrie::Types::String
|
109
|
-
property :thumbnail_id, type: Valkyrie::Types::String
|
110
|
-
property :rendering_ids, default: [], type: Valkyrie::Types::Array
|
111
103
|
|
112
104
|
# provide a lock token for optimistic locking; we name this `version` for
|
113
105
|
# backwards compatibility
|
@@ -119,10 +111,6 @@ module Hyrax
|
|
119
111
|
# @see https://github.com/samvera/valkyrie/wiki/Optimistic-Locking
|
120
112
|
property :version, virtual: true, prepopulator: LockKeyPrepopulator
|
121
113
|
|
122
|
-
# backs the child work search element;
|
123
|
-
# @todo: look for a way for the view template not to depend on this
|
124
|
-
property :find_child_work, default: nil, virtual: true
|
125
|
-
|
126
114
|
class << self
|
127
115
|
##
|
128
116
|
# @api public
|
@@ -143,6 +131,7 @@ module Hyrax
|
|
143
131
|
when Hyrax::PcdmCollection
|
144
132
|
Hyrax::Forms::PcdmCollectionForm.new(resource)
|
145
133
|
else
|
134
|
+
# NOTE: This will create a +Hyrax::Forms::PcdmObjectForm+.
|
146
135
|
Hyrax::Forms::ResourceForm(resource.class).new(resource)
|
147
136
|
end
|
148
137
|
end
|
@@ -219,20 +208,6 @@ module Hyrax
|
|
219
208
|
self.lease = Hyrax::LeaseManager.lease_for(resource: model)
|
220
209
|
end
|
221
210
|
|
222
|
-
def in_collections_populator(fragment:, **_options)
|
223
|
-
adds = []
|
224
|
-
deletes = []
|
225
|
-
fragment.each do |_, h|
|
226
|
-
if h["_destroy"] == "true"
|
227
|
-
deletes << Valkyrie::ID.new(h["id"])
|
228
|
-
else
|
229
|
-
adds << Valkyrie::ID.new(h["id"])
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
self.member_of_collection_ids = ((member_of_collection_ids + adds) - deletes).uniq
|
234
|
-
end
|
235
|
-
|
236
211
|
# https://trailblazer.to/2.1/docs/reform.html#reform-populators-populator-collections
|
237
212
|
def permission_populator(collection:, index:, **)
|
238
213
|
Hyrax::Forms::Permission.new(collection[index])
|
@@ -289,7 +289,7 @@ module Hyrax
|
|
289
289
|
end
|
290
290
|
|
291
291
|
def collection_title_by_id(id)
|
292
|
-
solr_docs = controller.repository.find(id).docs
|
292
|
+
solr_docs = controller.blacklight_config.repository.find(id).docs
|
293
293
|
return nil if solr_docs.empty?
|
294
294
|
solr_field = solr_docs.first["title_tesim"]
|
295
295
|
return nil if solr_field.nil?
|
@@ -9,7 +9,7 @@ module Hyrax
|
|
9
9
|
include Hyrax::VisibilityIndexer
|
10
10
|
include Hyrax::ThumbnailIndexer
|
11
11
|
include Hyrax::Indexer(:core_metadata)
|
12
|
-
include Hyrax::Indexer(:
|
12
|
+
include Hyrax::Indexer(:file_set_metadata)
|
13
13
|
|
14
14
|
def to_solr # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
15
15
|
super.tap do |solr_doc| # rubocop:disable Metrics/BlockLength
|
@@ -65,8 +65,9 @@ class CharacterizeJob < Hyrax::ApplicationJob
|
|
65
65
|
# mod time. This is done in the versioning code.
|
66
66
|
file_set.date_modified = Hyrax::TimeService.time_in_utc if file_set.characterization_proxy.original_checksum.first != previous_checksum
|
67
67
|
|
68
|
-
|
69
|
-
|
68
|
+
file_set.characterization_proxy.original_name.force_encoding("UTF-8")
|
69
|
+
# set title to label (i.e. file name, `original_name`) if that's how it was before this characterization
|
70
|
+
file_set.title = [file_set.characterization_proxy.original_name] if reset_title
|
70
71
|
# always set the label to the original_name
|
71
72
|
file_set.label = file_set.characterization_proxy.original_name
|
72
73
|
|
@@ -9,8 +9,6 @@ class ValkyrieCreateDerivativesJob < Hyrax::ApplicationJob
|
|
9
9
|
# Call derivatives with the file_set.
|
10
10
|
derivative_service = Hyrax::DerivativeService.for(file_metadata)
|
11
11
|
derivative_service.create_derivatives(file.disk_path)
|
12
|
-
# Trigger a reindex to get the thumbnail path.
|
13
|
-
Hyrax.publisher.publish('file.metadata.updated', metadata: file_metadata, user: nil)
|
14
12
|
end
|
15
13
|
|
16
14
|
private
|
@@ -414,7 +414,7 @@ module Hyrax
|
|
414
414
|
# @param document_id [String] the id of the document.
|
415
415
|
def user_is_depositor?(document_id)
|
416
416
|
doc = Hyrax::SolrService.search_by_id(document_id, fl: 'depositor_ssim')
|
417
|
-
current_user.user_key == doc
|
417
|
+
current_user.user_key == doc['depositor_ssim']&.first
|
418
418
|
end
|
419
419
|
|
420
420
|
def curation_concerns_models
|