From 553b58dbac720da142ae2c212df76ce5ed37a897 Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Thu, 23 Mar 2023 16:40:18 +0530 Subject: [PATCH 01/37] fix riiif viewer accept file from s3 --- hyrax/app/actors/hyrax/actors/file_actor.rb | 2 +- hyrax/app/models/file_set.rb | 6 ++++ hyrax/config/initializers/riiif.rb | 31 +++++++++++++++++++-- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/hyrax/app/actors/hyrax/actors/file_actor.rb b/hyrax/app/actors/hyrax/actors/file_actor.rb index 2121b223..27ddd9c3 100644 --- a/hyrax/app/actors/hyrax/actors/file_actor.rb +++ b/hyrax/app/actors/hyrax/actors/file_actor.rb @@ -84,7 +84,7 @@ module Hyrax file_set.characterization_proxy.original_checksum = uploaded_file.characterization_data['original_checksum'] file_set.characterization_proxy.format_label = [] - if file_set.image? + if file_set.mime_type_image? file_set.characterization_proxy.height = uploaded_file.characterization_data['height'] file_set.characterization_proxy.width = uploaded_file.characterization_data['width'] diff --git a/hyrax/app/models/file_set.rb b/hyrax/app/models/file_set.rb index 7cf09326..1bef1a28 100644 --- a/hyrax/app/models/file_set.rb +++ b/hyrax/app/models/file_set.rb @@ -20,6 +20,12 @@ class FileSet < ActiveFedora::Base FileSetFastLoadMetadata.find_by(fedora_file_set_id: id) end + def mime_type_image? + file_extention = ".#{self.title.first&.split('.')&.last}" + mime_type = Rack::Mime.mime_type(file_extention) + mime_type.include?('image') + end + private def create_file_set_with_fast_load_meta_data diff --git a/hyrax/config/initializers/riiif.rb b/hyrax/config/initializers/riiif.rb index 76e7e59b..dacdab8f 100644 --- a/hyrax/config/initializers/riiif.rb +++ b/hyrax/config/initializers/riiif.rb @@ -14,9 +14,8 @@ ActiveSupport::Reloader.to_prepare do end Riiif::Image.file_resolver.id_to_uri = lambda do |id| - Hyrax::Base.id_to_uri(CGI.unescape(id)).tap do |url| - Rails.logger.info "Riiif resolved #{id} to #{url}" - end + fs_id = id.sub(/\A([^\/]*)\/.*/, '\1') + s3_file_url(fs_id) end Riiif::Image.authorization_service = Hyrax::IIIFAuthorizationService @@ -25,4 +24,30 @@ ActiveSupport::Reloader.to_prepare do Riiif.unauthorized_image = Rails.root.join('app', 'assets', 'images', 'us_404.svg') Riiif::Engine.config.cache_duration = 365.days + + def s3_file_url(fs_id) + s3 = S3StorageService.new + s3.init_client + + file_set = FileSet.find(fs_id) + bucket_name = s3.sanitise_name(file_set.parent_works.first.id) + bucket = Aws::S3::Resource.new(region: ENV['S3_REGION']).bucket(bucket_name) + + begin + file_key = "/files/#{file_set.title.first}" + rescue StandardError + begin + file_key = "/files/#{file_set.title.first}" + rescue StandardError + return nil + end + end + + url_options = { + response_content_disposition: "attachment; filename=\"#{file_key}\"" + } + + object = bucket.object(file_key) + object.exists? ? object.presigned_url(:get, url_options).to_s : nil + end end -- GitLab From a8847d82dbc4d0fa25e64757799cd48085076bf9 Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Wed, 5 Apr 2023 16:52:45 +0530 Subject: [PATCH 02/37] added conditional validation for complex relations --- hyrax/app/assets/javascripts/dataset_form.js | 14 ++++++++++++++ .../records/edit_fields/_complex_relation.html.erb | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 hyrax/app/assets/javascripts/dataset_form.js diff --git a/hyrax/app/assets/javascripts/dataset_form.js b/hyrax/app/assets/javascripts/dataset_form.js new file mode 100644 index 00000000..eac7ed7b --- /dev/null +++ b/hyrax/app/assets/javascripts/dataset_form.js @@ -0,0 +1,14 @@ +$(document).on('change', '.complex_relation_section input:visible, .complex_relation_section select:visible', function() { + var is_required = false; + + var $field_wrapper = $(this).closest('.complex_relation_section'); + var $child_elements = $field_wrapper.find('input:visible, select:visible'); + + $child_elements.each(function(index, child){ + if ($(child).val().length > 0){ + is_required = true + } + }); + + is_required ? $child_elements.prop('required', true) : $child_elements.prop('required', false) +}); \ No newline at end of file diff --git a/hyrax/app/views/records/edit_fields/_complex_relation.html.erb b/hyrax/app/views/records/edit_fields/_complex_relation.html.erb index d6b0648c..1ef15b70 100644 --- a/hyrax/app/views/records/edit_fields/_complex_relation.html.erb +++ b/hyrax/app/views/records/edit_fields/_complex_relation.html.erb @@ -1,4 +1,4 @@ -<div class="multi-nested"> +<div class="multi-nested multi_value"> <%= f.input :complex_relation, as: :nested_relation, include_blank: false, -- GitLab From 532439b87e2450e9f82b8ecd623643861f578901 Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Thu, 6 Apr 2023 11:31:52 +0530 Subject: [PATCH 03/37] added missing code --- hyrax/app/inputs/nested_relation_input.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hyrax/app/inputs/nested_relation_input.rb b/hyrax/app/inputs/nested_relation_input.rb index 352ff8a9..8b84fa11 100644 --- a/hyrax/app/inputs/nested_relation_input.rb +++ b/hyrax/app/inputs/nested_relation_input.rb @@ -16,7 +16,7 @@ protected field_name = name_for(attribute_name, index, field, parent) field_id = id_for(attribute_name, index, field, parent) field_value = value.send(field).first - + out << "<div class='complex_relation_section'>" out << "<div class='row'>" out << " <div class='col-md-3'>" out << template.label_tag(field_name, 'Title', required: required) @@ -89,7 +89,8 @@ protected out << destroy_widget(attribute_name, index, field_label, parent) out << ' </div>' - out << '</div>' # last row + out << '</div>' + out << '</div>' out end end -- GitLab From 1b1acea788cf7aa2202091a1c8b563457c30bec7 Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Thu, 6 Apr 2023 13:11:40 +0530 Subject: [PATCH 04/37] refactor some code --- hyrax/app/actors/hyrax/actors/file_actor.rb | 16 +-------------- hyrax/app/helpers/hyrax_helper.rb | 21 +++----------------- hyrax/app/services/s3_storage_service.rb | 10 ++++++++++ hyrax/config/initializers/riiif.rb | 22 +++------------------ 4 files changed, 17 insertions(+), 52 deletions(-) diff --git a/hyrax/app/actors/hyrax/actors/file_actor.rb b/hyrax/app/actors/hyrax/actors/file_actor.rb index 27ddd9c3..d157d05e 100644 --- a/hyrax/app/actors/hyrax/actors/file_actor.rb +++ b/hyrax/app/actors/hyrax/actors/file_actor.rb @@ -154,22 +154,8 @@ module Hyrax target_object_key = generate_target_object_key(file_set) s3.move_object(source_object_key, target_bucket_name, target_object_key, { uploaded_file_path: source_object_key }) - target_object = target_bucket.object(target_object_key) - download_bucket = Aws::S3::Resource.new(region: ENV['S3_REGION']).bucket(target_bucket_name) - - url_options = { - response_content_disposition: "attachment; filename=\"#{target_object_key}\"" - } - object = download_bucket.object(target_object_key) - - return object.exists? ? object.presigned_url(:get, url_options).to_s : nil - end - - def change_repository_file_content(uploaded_file, repository_file, target_object) - uploaded_file.file.file.file = target_object - - repository_file.content = uploaded_file.file_url + return s3.presigned_url_for_downlad(target_bucket_name, target_object_key) end def generate_target_object_key(file_set) diff --git a/hyrax/app/helpers/hyrax_helper.rb b/hyrax/app/helpers/hyrax_helper.rb index 2287a119..b55250ed 100644 --- a/hyrax/app/helpers/hyrax_helper.rb +++ b/hyrax/app/helpers/hyrax_helper.rb @@ -23,24 +23,9 @@ module HyraxHelper file_set = FileSet.find(file_set_id) bucket_name = s3.sanitise_name(file_set.parent_works.first.id) - bucket = Aws::S3::Resource.new(region: ENV['S3_REGION']).bucket(bucket_name) - - begin - file_key = generate_target_object_key(file_set) - rescue StandardError - begin - file_key = generate_target_object_key(file_set) - rescue StandardError - return nil - end - end - url_options = { - expires_in: 60.minutes.seconds.to_i, - response_content_disposition: "attachment; filename=\"#{file_key}\"" - } - - object = bucket.object(file_key) - object.exists? ? object.presigned_url(:get, url_options).to_s : nil + file_key = generate_target_object_key(file_set) + + s3.presigned_url_for_downlad(bucket_name, file_key) end def can_create_work_in_group?(group_id) diff --git a/hyrax/app/services/s3_storage_service.rb b/hyrax/app/services/s3_storage_service.rb index a1b300f2..462d4fe2 100644 --- a/hyrax/app/services/s3_storage_service.rb +++ b/hyrax/app/services/s3_storage_service.rb @@ -198,4 +198,14 @@ class S3StorageService delete_bucket(b) end end + + def presigned_url_for_downlad(bucket_name, file_key) + bucket = Aws::S3::Resource.new(region: ENV['S3_REGION']).bucket(bucket_name) + url_options = { + response_content_disposition: "attachment; filename=\"#{file_key}\"" + } + + object = bucket.object(file_key) + object.exists? ? object.presigned_url(:get, url_options).to_s : nil + end end diff --git a/hyrax/config/initializers/riiif.rb b/hyrax/config/initializers/riiif.rb index dacdab8f..74330ba9 100644 --- a/hyrax/config/initializers/riiif.rb +++ b/hyrax/config/initializers/riiif.rb @@ -28,26 +28,10 @@ ActiveSupport::Reloader.to_prepare do def s3_file_url(fs_id) s3 = S3StorageService.new s3.init_client - + file_set = FileSet.find(fs_id) bucket_name = s3.sanitise_name(file_set.parent_works.first.id) - bucket = Aws::S3::Resource.new(region: ENV['S3_REGION']).bucket(bucket_name) - - begin - file_key = "/files/#{file_set.title.first}" - rescue StandardError - begin - file_key = "/files/#{file_set.title.first}" - rescue StandardError - return nil - end - end - - url_options = { - response_content_disposition: "attachment; filename=\"#{file_key}\"" - } - - object = bucket.object(file_key) - object.exists? ? object.presigned_url(:get, url_options).to_s : nil + file_key = "/files/#{file_set.title.first}" + s3.presigned_url_for_downlad(bucket_name, file_key) end end -- GitLab From bc2417bd573d6db5f5b09e65ce467da25cad771e Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Mon, 10 Apr 2023 20:00:07 +0530 Subject: [PATCH 05/37] implement connect with orcid --- hyrax/app/controllers/callbacks_controller.rb | 8 ++++- .../hyrax/dashboard/profiles/show.html.erb | 31 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 hyrax/app/views/hyrax/dashboard/profiles/show.html.erb diff --git a/hyrax/app/controllers/callbacks_controller.rb b/hyrax/app/controllers/callbacks_controller.rb index e55fc614..b8764e50 100644 --- a/hyrax/app/controllers/callbacks_controller.rb +++ b/hyrax/app/controllers/callbacks_controller.rb @@ -20,7 +20,13 @@ class CallbacksController < Devise::OmniauthCallbacksController def authenticate_and_authorize(provider) if current_user - redirect_to Hyrax::Engine.routes.url_helpers.dashboard_path + if current_user.orcid.nil? && provider.to_s == 'orcid' + current_user.update(orcid: request.env["omniauth.auth"].uid) + flash[:notice] = "You are now connected with ORCID" + redirect_to dashboard_profile_path(current_user) + else + redirect_to Hyrax::Engine.routes.url_helpers.dashboard_path + end else case provider.to_s when 'orcid' diff --git a/hyrax/app/views/hyrax/dashboard/profiles/show.html.erb b/hyrax/app/views/hyrax/dashboard/profiles/show.html.erb new file mode 100644 index 00000000..494f53a9 --- /dev/null +++ b/hyrax/app/views/hyrax/dashboard/profiles/show.html.erb @@ -0,0 +1,31 @@ +<% provide :page_header do %> + <h1><span class="fa fa-id-card" aria-hidden="true"></span> <%= t("hyrax.admin.sidebar.profile") %></h1> + <% if can? :edit, current_user %> + <div class="float-right"> + <%= link_to hyrax.edit_dashboard_profile_path(@user), class: "btn btn-primary" do %> + <%= t("hyrax.edit_profile") %> + <% end %> + <%= link_to omniauth_authorize_path(User, :orcid), method: :post, class: "btn btn-primary" do %> + <%= t("hyrax.connect_with_orcid") %> + <% end %> + </div> + <% end %> +<% end %> + +<div class="card"> + <div class="card-body"> + <div class="list-group col-md-5 col-sm-8"> + <%= render "hyrax/users/vitals", user: @user %> + + <div class="list-group-item"> + <%= render 'hyrax/users/user_info', user: @user %> + </div> + + <% if @presenter.trophies.any? %> + <div class="list-group-item"> + <%= render 'hyrax/users/contributions', presenter: @presenter %> + </div> + <% end %> + </div> + </div> +</div> \ No newline at end of file -- GitLab From 59e5a40c63a9311921d3d6b3cb35375dd50aad3b Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Mon, 10 Apr 2023 20:03:56 +0530 Subject: [PATCH 06/37] add filter on downlode work --- hyrax/app/services/s3_storage_service.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hyrax/app/services/s3_storage_service.rb b/hyrax/app/services/s3_storage_service.rb index a1b300f2..1c4bd302 100644 --- a/hyrax/app/services/s3_storage_service.rb +++ b/hyrax/app/services/s3_storage_service.rb @@ -178,7 +178,11 @@ class S3StorageService path = File.join(base_dir, object[:key]) dirname = File.dirname(path) FileUtils.mkdir_p(dirname) unless File.directory?(dirname) - get_content(s3_bucket, object[:key], path) + if object[:key] == "metadata.json" + filter_matadata_json_file(s3_bucket, object[:key], path) + else + get_content(s3_bucket, object[:key], path) + end end base_dir end @@ -198,4 +202,15 @@ class S3StorageService delete_bucket(b) end end + + private + + def filter_matadata_json_file(s3_bucket, key, path) + metadata_object = @s3_client.get_object(bucket: s3_bucket, key: key) + parsed_data = JSON.load(metadata_object.body) + filtered_data = parsed_data.slice('id', 'depositor', 'title') + File.open(path, 'w') do |f| + f.write(filtered_data) + end + end end -- GitLab From 852f0b7fcaebd648310417405aeb9f6160bf3f7f Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Mon, 10 Apr 2023 20:05:33 +0530 Subject: [PATCH 07/37] add translation --- hyrax/config/locales/hyrax.en.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/hyrax/config/locales/hyrax.en.yml b/hyrax/config/locales/hyrax.en.yml index af2d7568..91d00d43 100644 --- a/hyrax/config/locales/hyrax.en.yml +++ b/hyrax/config/locales/hyrax.en.yml @@ -208,6 +208,7 @@ en: new: Add New Work (dataset) hyrax: account_name: My Institution Account Id + connect_with_orcid: Connect With ORCID admin: admin_sets: document_list: -- GitLab From 9a5ec6dc0770a0896aab70bac259834556ac1da0 Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Tue, 11 Apr 2023 18:22:41 +0530 Subject: [PATCH 08/37] add some filters for download matadata --- hyrax/app/services/s3_storage_service.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hyrax/app/services/s3_storage_service.rb b/hyrax/app/services/s3_storage_service.rb index 1c4bd302..fd7d4d16 100644 --- a/hyrax/app/services/s3_storage_service.rb +++ b/hyrax/app/services/s3_storage_service.rb @@ -208,7 +208,11 @@ class S3StorageService def filter_matadata_json_file(s3_bucket, key, path) metadata_object = @s3_client.get_object(bucket: s3_bucket, key: key) parsed_data = JSON.load(metadata_object.body) - filtered_data = parsed_data.slice('id', 'depositor', 'title') + filtered_data = parsed_data.slice('id', 'depositor', 'title', 'alternative_title', 'description', 'abstract', 'keyword', 'license', 'publisher', 'subject', 'language') + filtered_data['Creators and Contributors'] = parsed_data['complex_person'].map { |person| person.slice('first_name', 'last_name', 'name', 'email', 'role', 'orcid', 'affiliation')} if parsed_data['complex_person'].present? + filtered_data['Related items'] = parsed_data['complex_relation'].map { |relation| relation.slice('title', 'url', 'relationship')} if parsed_data['complex_relation'].present? + filtered_data['Date'] = parsed_data['complex_date'].map { |date| date.slice('date', 'description')} if parsed_data['complex_date'].present? + filtered_data['Funding reference'] = parsed_data['complex_funding_reference'].map { |funding| funding.slice('funder_identifier', 'funder_name', 'award_number', 'award_uri', 'award_title')} if parsed_data['complex_funding_reference'].present? File.open(path, 'w') do |f| f.write(filtered_data) end -- GitLab From f55128ec7c7b6208df557eba6e4c1ae5c1e0eef5 Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Thu, 13 Apr 2023 18:17:12 +0530 Subject: [PATCH 09/37] some changes --- hyrax/app/actors/hyrax/actors/file_actor.rb | 23 ++------------------- hyrax/app/helpers/hyrax_helper.rb | 21 +------------------ hyrax/app/models/file_set.rb | 18 ++++++++++++++++ 3 files changed, 21 insertions(+), 41 deletions(-) diff --git a/hyrax/app/actors/hyrax/actors/file_actor.rb b/hyrax/app/actors/hyrax/actors/file_actor.rb index d157d05e..ff724fb1 100644 --- a/hyrax/app/actors/hyrax/actors/file_actor.rb +++ b/hyrax/app/actors/hyrax/actors/file_actor.rb @@ -151,29 +151,10 @@ module Hyrax target_bucket = Aws::S3::Bucket.new(target_bucket_name) s3.create_bucket(target_bucket_name) unless s3.bucket_exists?(target_bucket_name) - target_object_key = generate_target_object_key(file_set) - s3.move_object(source_object_key, target_bucket_name, target_object_key, { uploaded_file_path: source_object_key }) + s3.move_object(source_object_key, target_bucket_name, file_set.object_key_on_s3, { uploaded_file_path: source_object_key }) - return s3.presigned_url_for_downlad(target_bucket_name, target_object_key) - end - - def generate_target_object_key(file_set) - prefix = case file_set.for_complex_type - when 'ComplexSubject' - complex_subject = ComplexSubject.find_by(source_identifier: file_set.for_complex_identifier) - "#{complex_subject.subject_title}/files" - when 'ComplexSession' - complex_session = ComplexSession.find_by(source_identifier: file_set.for_complex_identifier) - "#{complex_session.complex_subject.subject_title}/#{complex_session.session_title}/files" - when 'ComplexModality' - complex_modality = ComplexModality.find_by(source_identifier: file_set.for_complex_identifier) - "#{complex_modality.complex_subject.subject_title}/#{complex_modality.complex_session.session_title}/#{complex_modality.modality_title}/files" - else - 'files' - end - - "/#{prefix}/#{file_set.title.first}" + s3.presigned_url_for_downlad(target_bucket_name, file_set.object_key_on_s3) end def clear_metadata(file_set) diff --git a/hyrax/app/helpers/hyrax_helper.rb b/hyrax/app/helpers/hyrax_helper.rb index b55250ed..72e238c0 100644 --- a/hyrax/app/helpers/hyrax_helper.rb +++ b/hyrax/app/helpers/hyrax_helper.rb @@ -23,9 +23,8 @@ module HyraxHelper file_set = FileSet.find(file_set_id) bucket_name = s3.sanitise_name(file_set.parent_works.first.id) - file_key = generate_target_object_key(file_set) - s3.presigned_url_for_downlad(bucket_name, file_key) + s3.presigned_url_for_downlad(bucket_name, file_set.object_key_on_s3) end def can_create_work_in_group?(group_id) @@ -62,24 +61,6 @@ module HyraxHelper total_size > 0 && total_size < ENV.fetch('DOWNLOAD_SIZE_LIMIT', '100000000').to_i end - def generate_target_object_key(file_set) - prefix = case file_set.for_complex_type - when 'ComplexSubject' - complex_subject = ComplexSubject.find_by(source_identifier: file_set.for_complex_identifier) - "#{complex_subject.subject_title}/files" - when 'ComplexSession' - complex_session = ComplexSession.find_by(source_identifier: file_set.for_complex_identifier) - "#{complex_session.complex_subject.subject_title}/#{complex_session.session_title}/files" - when 'ComplexModality' - complex_modality = ComplexModality.find_by(source_identifier: file_set.for_complex_identifier) - "#{complex_modality.complex_subject.subject_title}/#{complex_modality.complex_session.session_title}/#{complex_modality.modality_title}/files" - else - 'files' - end - - "/#{prefix}/#{file_set.title.first}" - end - def is_tombstonable?(presenter) presenter.tombstone_status != ['initiated'] && (is_published?(presenter) || is_archived?(presenter)) end diff --git a/hyrax/app/models/file_set.rb b/hyrax/app/models/file_set.rb index 1bef1a28..075e8fd4 100644 --- a/hyrax/app/models/file_set.rb +++ b/hyrax/app/models/file_set.rb @@ -26,6 +26,24 @@ class FileSet < ActiveFedora::Base mime_type.include?('image') end + def object_key_on_s3 + prefix = case for_complex_type + when 'ComplexSubject' + complex_subject = ComplexSubject.find_by(source_identifier: for_complex_identifier) + "#{complex_subject.subject_title}/files" + when 'ComplexSession' + complex_session = ComplexSession.find_by(source_identifier: for_complex_identifier) + "#{complex_session.complex_subject.subject_title}/#{complex_session.session_title}/files" + when 'ComplexModality' + complex_modality = ComplexModality.find_by(source_identifier: for_complex_identifier) + "#{complex_modality.complex_subject.subject_title}/#{complex_modality.complex_session.session_title}/#{complex_modality.modality_title}/files" + else + 'files' + end + + "/#{prefix}/#{title.first}" + end + private def create_file_set_with_fast_load_meta_data -- GitLab From c31e6df229a8adc5a9b70cdfbe2d5e004719bb02 Mon Sep 17 00:00:00 2001 From: Pascal Ernster <pascal.ernster@rub.de> Date: Fri, 14 Apr 2023 17:12:11 +0200 Subject: [PATCH 10/37] Update ruby 2.7.7 to 2.7.8 --- hyrax/Dockerfile | 2 +- hyrax/Gemfile | 2 +- hyrax/Gemfile.lock | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hyrax/Dockerfile b/hyrax/Dockerfile index f2ffdd0f..c1c6f435 100644 --- a/hyrax/Dockerfile +++ b/hyrax/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.7.7-alpine +FROM ruby:2.7.8-alpine # Setup build variables ARG RAILS_ENV diff --git a/hyrax/Gemfile b/hyrax/Gemfile index f5e05309..485c88d8 100644 --- a/hyrax/Gemfile +++ b/hyrax/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.7.7' +ruby '2.7.8' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.2.6' diff --git a/hyrax/Gemfile.lock b/hyrax/Gemfile.lock index f3dd0909..f8d8e744 100644 --- a/hyrax/Gemfile.lock +++ b/hyrax/Gemfile.lock @@ -1064,7 +1064,7 @@ DEPENDENCIES web-console (>= 3.3.0) RUBY VERSION - ruby 2.7.7p221 + ruby 2.7.8p225 BUNDLED WITH 2.1.4 -- GitLab From 89be5f297f5deee412044db398a26cce6e82cf86 Mon Sep 17 00:00:00 2001 From: Pascal Ernster <pascal.ernster@rub.de> Date: Fri, 14 Apr 2023 17:37:09 +0200 Subject: [PATCH 11/37] docker-compose.yml: Add health check for "db" container --- docker-compose.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index fcb918ec..d797b2f5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,6 +55,11 @@ services: - .env expose: - 5432 + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -h localhost"] + interval: 30s + timeout: 5s + retries: 3 fcrepodb: <<: *db environment: -- GitLab From 3cb81c2c8e1ece77511a2caa829d20bfe84b1237 Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Thu, 20 Apr 2023 16:01:12 +0530 Subject: [PATCH 12/37] Transfer ownership to publication manager after publish dataset --- .../services/hyrax/workflow/transfer_ownership.rb | 12 ++++++++++++ .../one_step_mediated_deposit_workflow.json | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 hyrax/app/services/hyrax/workflow/transfer_ownership.rb diff --git a/hyrax/app/services/hyrax/workflow/transfer_ownership.rb b/hyrax/app/services/hyrax/workflow/transfer_ownership.rb new file mode 100644 index 00000000..19583a54 --- /dev/null +++ b/hyrax/app/services/hyrax/workflow/transfer_ownership.rb @@ -0,0 +1,12 @@ +module Hyrax + module Workflow + ## + # This is a built in function for workflow, so that a workflow action can be created that + # Transfer Ownership for dataset + module TransferOwnership + def self.call(target:, user:, **) + Hyrax::ChangeDepositorService.call(target, user, false) + end + end + end +end diff --git a/hyrax/config/workflows/one_step_mediated_deposit_workflow.json b/hyrax/config/workflows/one_step_mediated_deposit_workflow.json index b0e5781a..754f3225 100644 --- a/hyrax/config/workflows/one_step_mediated_deposit_workflow.json +++ b/hyrax/config/workflows/one_step_mediated_deposit_workflow.json @@ -136,7 +136,8 @@ "Hyrax::Workflow::RevokeEditFromDepositor", "Hyrax::Workflow::GrantReadToPublicationManager", "Hyrax::Workflow::ActivateObject", - "Hyrax::Workflow::RegisterDoi" + "Hyrax::Workflow::RegisterDoi", + "Hyrax::Workflow::TransferOwnership" ] }, { -- GitLab From 70b723cf0533e389d88f7dce92493aaf73d5de55 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Thu, 20 Apr 2023 16:51:04 +0100 Subject: [PATCH 13/37] Changes to support handlign large number of files --- .env.template | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.env.template b/.env.template index a4bb5157..833b64ad 100644 --- a/.env.template +++ b/.env.template @@ -117,6 +117,8 @@ S3_BUCKET_PREFIX= CRC_1280_COLLECTION=CRC 1280 # File uploads +RUBY_THREAD_MACHINE_STACK_SIZE=8388608 +RUBY_THREAD_VM_STACK_SIZE=8388608 MAX_FILES=1000 MAX_FILE_SIZE=2.gigabytes -- GitLab From 909acc16aa7668687f4ffc18103a84656cb13a69 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Fri, 21 Apr 2023 00:31:08 +0100 Subject: [PATCH 14/37] Added help text for relationship --- hyrax/config/locales/en.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/hyrax/config/locales/en.yml b/hyrax/config/locales/en.yml index fd52b8fc..c78edf12 100644 --- a/hyrax/config/locales/en.yml +++ b/hyrax/config/locales/en.yml @@ -70,6 +70,7 @@ en: publisher: The person or group making the work (dataset) available. complex_person: 'Authors or contributors to the work (dataset). Enter the Surname, the Given name, and select their Role. A person can have multiple Given names. <br/>For affiliation, enter details of the affiliation, e.g. Chair, Institute, Faculty, University' complex_identifier: External identifiers, if applicable. + complex_relation: If adding a relationship, all of the three fields are required. The URL needs to be the complete canonical URL of the item. placeholders: defaults: language: "De" -- GitLab From b9c1e9432cf1436ee45b1fe65024638b44cc0980 Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Fri, 21 Apr 2023 12:25:20 +0530 Subject: [PATCH 15/37] some changes --- hyrax/app/controllers/callbacks_controller.rb | 2 +- .../dashboard/profiles/_edit_primary.html.erb | 27 ++++++++++------ .../hyrax/dashboard/profiles/edit.html.erb | 14 +++++++++ .../hyrax/dashboard/profiles/show.html.erb | 31 ------------------- 4 files changed, 32 insertions(+), 42 deletions(-) create mode 100644 hyrax/app/views/hyrax/dashboard/profiles/edit.html.erb delete mode 100644 hyrax/app/views/hyrax/dashboard/profiles/show.html.erb diff --git a/hyrax/app/controllers/callbacks_controller.rb b/hyrax/app/controllers/callbacks_controller.rb index b8764e50..c0356523 100644 --- a/hyrax/app/controllers/callbacks_controller.rb +++ b/hyrax/app/controllers/callbacks_controller.rb @@ -23,7 +23,7 @@ class CallbacksController < Devise::OmniauthCallbacksController if current_user.orcid.nil? && provider.to_s == 'orcid' current_user.update(orcid: request.env["omniauth.auth"].uid) flash[:notice] = "You are now connected with ORCID" - redirect_to dashboard_profile_path(current_user) + redirect_to edit_dashboard_profile_path (current_user) else redirect_to Hyrax::Engine.routes.url_helpers.dashboard_path end diff --git a/hyrax/app/views/hyrax/dashboard/profiles/_edit_primary.html.erb b/hyrax/app/views/hyrax/dashboard/profiles/_edit_primary.html.erb index fe910b44..bb87e5f1 100644 --- a/hyrax/app/views/hyrax/dashboard/profiles/_edit_primary.html.erb +++ b/hyrax/app/views/hyrax/dashboard/profiles/_edit_primary.html.erb @@ -2,8 +2,8 @@ url: hyrax.dashboard_profile_path(@user.to_param), html: { multipart: true, class: 'form-horizontal' } do |f| %> <div class="form-group"> - <%= f.label :avatar, t(".change_picture").html_safe, class: "col-xs-4 control-label" %> - <div class="col-xs-8"> + <%= f.label :avatar, t(".change_picture").html_safe, class: "col-xs-2 control-label" %> + <div class="col-xs-10"> <%= image_tag @user.avatar.url(:thumb) if @user.avatar? %> <%= f.file_field :avatar %> <%= f.hidden_field :avatar_cache %> @@ -24,31 +24,38 @@ <% end %> <div class="form-group"> - <%= f.label :orcid, class: 'col-xs-4 control-label' do %> + <%= f.label :orcid, class: 'col-xs-2 control-label' do %> <%= orcid_label %> <% end %> - <div class="col-xs-8"> + <div class="col-xs-6"> <%= f.text_field :orcid, class: "form-control", disabled: "disabled" %> </div> + <div class="col-xs-2"> + <% if @user.orcid.nil? %> + <%= link_to omniauth_authorize_path(User, :orcid), method: :post, class: "btn btn-primary" do %> + <%= t("hyrax.connect_with_orcid") %> + <% end %> + <% end %> + </div> </div><!-- .form-group --> <div class="form-group"> - <%= f.label :twitter_handle, t(".twitter_handle").html_safe, class: 'col-xs-4 control-label' %> - <div class="col-xs-8"> + <%= f.label :twitter_handle, t(".twitter_handle").html_safe, class: 'col-xs-2 control-label' %> + <div class="col-xs-6"> <%= f.text_field :twitter_handle, class: "form-control" %> </div> </div><!-- .form-group --> <div class="form-group"> - <%= f.label :facebook_handle, t(".facebook_handle").html_safe, class: 'col-xs-4 control-label' %> - <div class="col-xs-8"> + <%= f.label :facebook_handle, t(".facebook_handle").html_safe, class: 'col-xs-2 control-label' %> + <div class="col-xs-6"> <%= f.text_field :facebook_handle, class: "form-control" %> </div> </div><!-- .form-group --> <div class="form-group"> - <%= f.label :googleplus_handle, t(".google_handle").html_safe, class: 'col-xs-4 control-label' %> - <div class="col-xs-8"> + <%= f.label :googleplus_handle, t(".google_handle").html_safe, class: 'col-xs-2 control-label' %> + <div class="col-xs-6"> <%= f.text_field :googleplus_handle, class: "form-control" %> </div> </div><!-- .form-group --> diff --git a/hyrax/app/views/hyrax/dashboard/profiles/edit.html.erb b/hyrax/app/views/hyrax/dashboard/profiles/edit.html.erb new file mode 100644 index 00000000..e9ac9da4 --- /dev/null +++ b/hyrax/app/views/hyrax/dashboard/profiles/edit.html.erb @@ -0,0 +1,14 @@ +<% provide :page_header do %> + <h1><span class="fa fa-id-card" aria-hidden="true"></span> Edit Profile</h1> +<% end %> +<div class="card"> + <div class="card-body"> + <div class="col-sm-12 profile"> + <%= render 'edit_primary' %> + </div> + + <div class="col-sm-6 profile"> + <%= render 'edit_secondary' %> + </div> + </div> +</div> \ No newline at end of file diff --git a/hyrax/app/views/hyrax/dashboard/profiles/show.html.erb b/hyrax/app/views/hyrax/dashboard/profiles/show.html.erb deleted file mode 100644 index 494f53a9..00000000 --- a/hyrax/app/views/hyrax/dashboard/profiles/show.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -<% provide :page_header do %> - <h1><span class="fa fa-id-card" aria-hidden="true"></span> <%= t("hyrax.admin.sidebar.profile") %></h1> - <% if can? :edit, current_user %> - <div class="float-right"> - <%= link_to hyrax.edit_dashboard_profile_path(@user), class: "btn btn-primary" do %> - <%= t("hyrax.edit_profile") %> - <% end %> - <%= link_to omniauth_authorize_path(User, :orcid), method: :post, class: "btn btn-primary" do %> - <%= t("hyrax.connect_with_orcid") %> - <% end %> - </div> - <% end %> -<% end %> - -<div class="card"> - <div class="card-body"> - <div class="list-group col-md-5 col-sm-8"> - <%= render "hyrax/users/vitals", user: @user %> - - <div class="list-group-item"> - <%= render 'hyrax/users/user_info', user: @user %> - </div> - - <% if @presenter.trophies.any? %> - <div class="list-group-item"> - <%= render 'hyrax/users/contributions', presenter: @presenter %> - </div> - <% end %> - </div> - </div> -</div> \ No newline at end of file -- GitLab From 9bb64a240d937486ef2c644df11f8d257c607a76 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Wed, 26 Apr 2023 22:45:34 +0100 Subject: [PATCH 16/37] Fixed redirect path --- hyrax/app/controllers/callbacks_controller.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hyrax/app/controllers/callbacks_controller.rb b/hyrax/app/controllers/callbacks_controller.rb index c0356523..c8ed6e59 100644 --- a/hyrax/app/controllers/callbacks_controller.rb +++ b/hyrax/app/controllers/callbacks_controller.rb @@ -23,10 +23,8 @@ class CallbacksController < Devise::OmniauthCallbacksController if current_user.orcid.nil? && provider.to_s == 'orcid' current_user.update(orcid: request.env["omniauth.auth"].uid) flash[:notice] = "You are now connected with ORCID" - redirect_to edit_dashboard_profile_path (current_user) - else - redirect_to Hyrax::Engine.routes.url_helpers.dashboard_path end + redirect_to Hyrax::Engine.routes.url_helpers.dashboard_path else case provider.to_s when 'orcid' -- GitLab From 930a13cd9521b42ed484e4e7fb11dae3d8a7ac79 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Wed, 26 Apr 2023 22:47:29 +0100 Subject: [PATCH 17/37] Convert to json before writing to file --- hyrax/app/services/s3_storage_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyrax/app/services/s3_storage_service.rb b/hyrax/app/services/s3_storage_service.rb index fd7d4d16..461ea8eb 100644 --- a/hyrax/app/services/s3_storage_service.rb +++ b/hyrax/app/services/s3_storage_service.rb @@ -214,7 +214,7 @@ class S3StorageService filtered_data['Date'] = parsed_data['complex_date'].map { |date| date.slice('date', 'description')} if parsed_data['complex_date'].present? filtered_data['Funding reference'] = parsed_data['complex_funding_reference'].map { |funding| funding.slice('funder_identifier', 'funder_name', 'award_number', 'award_uri', 'award_title')} if parsed_data['complex_funding_reference'].present? File.open(path, 'w') do |f| - f.write(filtered_data) + f.write(filtered_data.to_json) end end end -- GitLab From fd1e891699d5597b6b9dc46d0d1db5333b3cb157 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Wed, 26 Apr 2023 23:06:00 +0100 Subject: [PATCH 18/37] Fixed merge error --- hyrax/app/services/s3_storage_service.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/hyrax/app/services/s3_storage_service.rb b/hyrax/app/services/s3_storage_service.rb index e1b5929c..1527620b 100644 --- a/hyrax/app/services/s3_storage_service.rb +++ b/hyrax/app/services/s3_storage_service.rb @@ -211,6 +211,7 @@ class S3StorageService object = bucket.object(file_key) object.exists? ? object.presigned_url(:get, url_options).to_s : nil + end private -- GitLab From 4457ed3f131305576278bfe73cccf91a59d24338 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Thu, 27 Apr 2023 11:46:49 +0100 Subject: [PATCH 19/37] Added missing translation for Download All --- hyrax/config/locales/hyrax.en.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/hyrax/config/locales/hyrax.en.yml b/hyrax/config/locales/hyrax.en.yml index af2d7568..9d9b9c22 100644 --- a/hyrax/config/locales/hyrax.en.yml +++ b/hyrax/config/locales/hyrax.en.yml @@ -346,6 +346,7 @@ en: create_service: admin_set_description: An aggregation of works (datasets) that is intended to help with administrative control. Admin Sets provide a way of defining behaviors and policies around a set of works. default_description: A User Collection can be created by any user to organize their works (datasets). + download_all: Download All dashboard: admin_sets: works: Works (datasets) -- GitLab From 56db8782cd90deb6a630423d4d3ab33bef6afad5 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Thu, 27 Apr 2023 11:48:03 +0100 Subject: [PATCH 20/37] Added class to trigger download stats in Matomo --- hyrax/app/views/hyrax/base/_download_all.html.erb | 2 +- hyrax/app/views/hyrax/file_sets/_actions.html.erb | 4 ++-- hyrax/app/views/hyrax/file_sets/media_display/_audio.html.erb | 1 + .../app/views/hyrax/file_sets/media_display/_default.html.erb | 1 + hyrax/app/views/hyrax/file_sets/media_display/_image.html.erb | 1 + .../hyrax/file_sets/media_display/_office_document.html.erb | 1 + hyrax/app/views/hyrax/file_sets/media_display/_pdf.html.erb | 1 + hyrax/app/views/hyrax/file_sets/media_display/_video.html.erb | 1 + 8 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hyrax/app/views/hyrax/base/_download_all.html.erb b/hyrax/app/views/hyrax/base/_download_all.html.erb index 4c6e89c6..fd68f5ec 100644 --- a/hyrax/app/views/hyrax/base/_download_all.html.erb +++ b/hyrax/app/views/hyrax/base/_download_all.html.erb @@ -4,7 +4,7 @@ <%= link_to t(:'hyrax.download_all'), main_app.download_all_path(presenter.id, format: :zip), id: "download-all", - class: "btn btn-default", + class: "btn btn-default matomo_download", target: "_new" %> </div> diff --git a/hyrax/app/views/hyrax/file_sets/_actions.html.erb b/hyrax/app/views/hyrax/file_sets/_actions.html.erb index ece63f0a..36136075 100644 --- a/hyrax/app/views/hyrax/file_sets/_actions.html.erb +++ b/hyrax/app/views/hyrax/file_sets/_actions.html.erb @@ -2,7 +2,7 @@ <% if can?(:download, file_set.id) && !(can?(:edit, file_set.id) || can?(:destroy, file_set.id)) && s3_file_download_url_for_file_set(file_set.id).present? %> <%= link_to t('.download'), s3_file_download_url_for_file_set(file_set.id), - class: 'btn btn-secondary btn-sm', + class: 'btn btn-secondary btn-sm matomo_download', title: t('.download_title', file_set: file_set), target: "_blank", id: "file_download", @@ -42,7 +42,7 @@ title: t('.download_title', file_set: file_set), target: "_blank", id: "file_download", - class: "download", + class: "download matomo_download", data: { label: file_set.id, work_id: @presenter.id, collection_ids: @presenter.member_of_collection_ids } %> </li> <% end %> diff --git a/hyrax/app/views/hyrax/file_sets/media_display/_audio.html.erb b/hyrax/app/views/hyrax/file_sets/media_display/_audio.html.erb index cbb90ccd..a56b24fe 100644 --- a/hyrax/app/views/hyrax/file_sets/media_display/_audio.html.erb +++ b/hyrax/app/views/hyrax/file_sets/media_display/_audio.html.erb @@ -12,6 +12,7 @@ s3_file_download_url_for_file_set(file_set.id), data: { label: file_set.id }, target: :_blank, + class: "matomo_download", id: "file_download" %> </div> <% else %> diff --git a/hyrax/app/views/hyrax/file_sets/media_display/_default.html.erb b/hyrax/app/views/hyrax/file_sets/media_display/_default.html.erb index 73077358..a4483373 100644 --- a/hyrax/app/views/hyrax/file_sets/media_display/_default.html.erb +++ b/hyrax/app/views/hyrax/file_sets/media_display/_default.html.erb @@ -5,6 +5,7 @@ s3_file_download_url_for_file_set(file_set.id), id: "file_download", data: { label: file_set.id }, + class: "matomo_download", target: "_new" %> <% end %> </div> \ No newline at end of file diff --git a/hyrax/app/views/hyrax/file_sets/media_display/_image.html.erb b/hyrax/app/views/hyrax/file_sets/media_display/_image.html.erb index c20cd677..a61cb6f3 100644 --- a/hyrax/app/views/hyrax/file_sets/media_display/_image.html.erb +++ b/hyrax/app/views/hyrax/file_sets/media_display/_image.html.erb @@ -9,6 +9,7 @@ s3_file_download_url_for_file_set(file_set.id), data: { label: file_set.id }, target: :_blank, + class: "matomo_download", id: "file_download" %> </div> <% elsif s3_file_download_url_for_file_set(file_set.id).present? %> diff --git a/hyrax/app/views/hyrax/file_sets/media_display/_office_document.html.erb b/hyrax/app/views/hyrax/file_sets/media_display/_office_document.html.erb index 095afd86..e755581e 100644 --- a/hyrax/app/views/hyrax/file_sets/media_display/_office_document.html.erb +++ b/hyrax/app/views/hyrax/file_sets/media_display/_office_document.html.erb @@ -9,6 +9,7 @@ s3_file_download_url_for_file_set(file_set.id), target: :_blank, id: "file_download", + class: "matomo_download", data: { label: file_set.id } %> </div> <% else %> diff --git a/hyrax/app/views/hyrax/file_sets/media_display/_pdf.html.erb b/hyrax/app/views/hyrax/file_sets/media_display/_pdf.html.erb index 16737e0d..39b247f6 100644 --- a/hyrax/app/views/hyrax/file_sets/media_display/_pdf.html.erb +++ b/hyrax/app/views/hyrax/file_sets/media_display/_pdf.html.erb @@ -9,6 +9,7 @@ s3_file_download_url_for_file_set(file_set.id), target: :_blank, id: "file_download", + class: "matomo_download", data: { label: file_set.id } %> </div> <% else %> diff --git a/hyrax/app/views/hyrax/file_sets/media_display/_video.html.erb b/hyrax/app/views/hyrax/file_sets/media_display/_video.html.erb index 78550ced..8bf57815 100644 --- a/hyrax/app/views/hyrax/file_sets/media_display/_video.html.erb +++ b/hyrax/app/views/hyrax/file_sets/media_display/_video.html.erb @@ -12,6 +12,7 @@ s3_file_url, data: { label: file_set.id }, target: :_blank, + class: "matomo_download", id: "file_download" %> </div> <% else %> -- GitLab From 49c73b14d4ac0078a5bd7f641a9dff65b0fc2c51 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Thu, 27 Apr 2023 12:21:52 +0100 Subject: [PATCH 21/37] Read host from application url for persistent hostpath --- hyrax/config/initializers/hyrax.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyrax/config/initializers/hyrax.rb b/hyrax/config/initializers/hyrax.rb index 44cb7c1a..b5023c50 100644 --- a/hyrax/config/initializers/hyrax.rb +++ b/hyrax/config/initializers/hyrax.rb @@ -53,7 +53,7 @@ Hyrax.config do |config| # config.temp_file_base = '/home/developer1' # Hostpath to be used in Endnote exports - # config.persistent_hostpath = 'http://localhost/files/' + config.persistent_hostpath = "#{ENV['APPLICATION_URL'] || 'http://localhost'}/files/" # If you have ffmpeg installed and want to transcode audio and video set to true config.enable_ffmpeg = true -- GitLab From ff129addc34bed5a671eee29e6ca74d2cf3b3a2a Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Fri, 28 Apr 2023 12:13:28 +0530 Subject: [PATCH 22/37] set default workflow based on work_type --- hyrax/app/models/crc_dataset.rb | 4 ++++ hyrax/app/models/dataset.rb | 4 ++++ hyrax/app/views/hyrax/base/_form_relationships.html.erb | 1 + 3 files changed, 9 insertions(+) mode change 100644 => 100755 hyrax/app/models/crc_dataset.rb mode change 100644 => 100755 hyrax/app/models/dataset.rb mode change 100644 => 100755 hyrax/app/views/hyrax/base/_form_relationships.html.erb diff --git a/hyrax/app/models/crc_dataset.rb b/hyrax/app/models/crc_dataset.rb old mode 100644 new mode 100755 index 63748473..f71fdabc --- a/hyrax/app/models/crc_dataset.rb +++ b/hyrax/app/models/crc_dataset.rb @@ -148,6 +148,10 @@ class CrcDataset < ActiveFedora::Base FileSetFastLoadMetadata.where(work_source_identifier: source.first) end + def default_admin_set + AdminSet.where(title: ENV.fetch('CRC_ADMIN_SET_TITLE', 'CRC 1280 Publishing Workflow')).first + end + private def set_default_source_and_tombstone_status diff --git a/hyrax/app/models/dataset.rb b/hyrax/app/models/dataset.rb old mode 100644 new mode 100755 index af76216e..a666e748 --- a/hyrax/app/models/dataset.rb +++ b/hyrax/app/models/dataset.rb @@ -116,6 +116,10 @@ class Dataset < ActiveFedora::Base accepts_nested_attributes_for :complex_relation, reject_if: :relation_blank, allow_destroy: true accepts_nested_attributes_for :updated_subresources, allow_destroy: true + def default_admin_set + AdminSet.where(title: ENV.fetch('RUB_ADMIN_SET_TITLE', 'RUB publication workflow')).first + end + private def set_default_tombstone_status diff --git a/hyrax/app/views/hyrax/base/_form_relationships.html.erb b/hyrax/app/views/hyrax/base/_form_relationships.html.erb old mode 100644 new mode 100755 index 39912085..c76dfb31 --- a/hyrax/app/views/hyrax/base/_form_relationships.html.erb +++ b/hyrax/app/views/hyrax/base/_form_relationships.html.erb @@ -2,6 +2,7 @@ <%= f.input :admin_set_id, as: :select, include_blank: false, collection: admin_set_options, + selected: f.object.model.default_admin_set.id, input_html: { class: 'form-control' } %> <% end %> -- GitLab From bde8574038ad7639ff441f6ae6f555162c99e3b0 Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Fri, 28 Apr 2023 12:16:49 +0530 Subject: [PATCH 23/37] add env variables --- .env.template.development | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.env.template.development b/.env.template.development index 3994688a..5f9b82dd 100644 --- a/.env.template.development +++ b/.env.template.development @@ -170,3 +170,5 @@ DOI_PREFIX= DOWNLOAD_SIZE_LIMIT=100000000 DOWNLOAD_PATH=tmp/downloads +RUB_ADMIN_SET_TITLE="RUB publication workflow" +CRC_ADMIN_SET_TITLE="CRC 1280 Publishing Workflow" \ No newline at end of file -- GitLab From 5478d9231dda731a978bf762f74c8162b8a72cff Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Fri, 28 Apr 2023 13:14:25 +0530 Subject: [PATCH 24/37] add rake task for creating default admin_set --- .../tasks/default_admin_set_for_workflow.rake | 33 +++++++++++++++++++ hyrax/lib/tasks/setup_hyrax.rake | 1 + 2 files changed, 34 insertions(+) create mode 100644 hyrax/lib/tasks/default_admin_set_for_workflow.rake diff --git a/hyrax/lib/tasks/default_admin_set_for_workflow.rake b/hyrax/lib/tasks/default_admin_set_for_workflow.rake new file mode 100644 index 00000000..83658bb6 --- /dev/null +++ b/hyrax/lib/tasks/default_admin_set_for_workflow.rake @@ -0,0 +1,33 @@ + +# frozen_string_literal: true +namespace :hyrax do + namespace :default_admin_set_for_workflow do + desc "Create the Default Admin Set" + task create: :environment do + admin_role = Role.find_by(name: "admin") + admin_user = admin_role&.users&.first + + if admin_user.present? + rub_default_admin_set_title = ENV.fetch('RUB_ADMIN_SET_TITLE', 'RUB publication workflow') + crc_default_admin_set_title = ENV.fetch('CRC_ADMIN_SET_TITLE', 'CRC 1280 Publishing Workflow') + + [rub_default_admin_set_title, crc_default_admin_set_title].each do |title| + unless AdminSet.where(title: [title]).present? + admin_set = AdminSet.new(title: [title]) + admin_set.save + + Hyrax::AdminSetCreateService.call(admin_set: admin_set, creating_user: admin_user) + + workflow_name = title == rub_default_admin_set_title ? 'rub_publication_workflow' : 'three_step_mediated_deposit' + + mediated_workflow = admin_set.permission_template.available_workflows.where(name: workflow_name).first + + Sipity::Workflow.activate!(permission_template: admin_set.permission_template, workflow_id: mediated_workflow.id) + end + end + else + puts "Admin Sets not created, No Admin user exist" + end + end + end +end diff --git a/hyrax/lib/tasks/setup_hyrax.rake b/hyrax/lib/tasks/setup_hyrax.rake index e8fe880f..af5a3728 100644 --- a/hyrax/lib/tasks/setup_hyrax.rake +++ b/hyrax/lib/tasks/setup_hyrax.rake @@ -22,6 +22,7 @@ namespace :rdms do # Create default administrative set and load workflow ###### Rake::Task['hyrax:default_admin_set:create'].invoke + Rake::Task['hyrax:default_admin_set_for_workflow:create'].invoke Rake::Task['hyrax:workflow:load'].invoke Rake::Task['hyrax:default_collection_types:create'].invoke Rake::Task['rdms:crc_1280_collection:create'].invoke -- GitLab From 8fded8faa73df4f9fb5d1bced92a15d582b3f124 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Fri, 28 Apr 2023 09:06:45 +0100 Subject: [PATCH 25/37] Add public visbility and transfer ownership chages to workflow --- .env.template | 2 + .env.template.development | 2 + hyrax/app/models/user.rb | 84 ++++++++++- .../hyrax/workflow/make_visibility_public.rb | 13 ++ .../hyrax/workflow/transfer_ownership.rb | 5 +- ...son => crc_1280_publication_workflow.json} | 4 +- hyrax/config/workflows/default_workflow.json | 21 --- .../workflows/mediated_deposit_workflow.json | 131 ------------------ ...low.json => rub_publication_workflow.json} | 16 ++- .../lib/tasks/create_publication_manager.rake | 9 ++ hyrax/lib/tasks/setup_hyrax.rake | 2 +- hyrax/lib/tasks/setup_users.rake | 59 +------- 12 files changed, 128 insertions(+), 220 deletions(-) create mode 100644 hyrax/app/services/hyrax/workflow/make_visibility_public.rb rename hyrax/config/workflows/{three_step_mediated_deposit_workflow.json => crc_1280_publication_workflow.json} (99%) delete mode 100644 hyrax/config/workflows/default_workflow.json delete mode 100644 hyrax/config/workflows/mediated_deposit_workflow.json rename hyrax/config/workflows/{one_step_mediated_deposit_workflow.json => rub_publication_workflow.json} (93%) create mode 100644 hyrax/lib/tasks/create_publication_manager.rake diff --git a/.env.template b/.env.template index b979f9e7..754d3bf2 100644 --- a/.env.template +++ b/.env.template @@ -167,3 +167,5 @@ ARK_NAAN= DOWNLOAD_SIZE_LIMIT=100000000 DOWNLOAD_PATH=tmp/downloads +# System user with role publication manager +SYSTEM_PUBLICATION_MANAGER=publication_manager@hyrax \ No newline at end of file diff --git a/.env.template.development b/.env.template.development index 3994688a..87a14f6b 100644 --- a/.env.template.development +++ b/.env.template.development @@ -170,3 +170,5 @@ DOI_PREFIX= DOWNLOAD_SIZE_LIMIT=100000000 DOWNLOAD_PATH=tmp/downloads +# System user with role publication manager +SYSTEM_PUBLICATION_MANAGER=publication_manager@hyrax \ No newline at end of file diff --git a/hyrax/app/models/user.rb b/hyrax/app/models/user.rb index e1f60dbb..c607faf3 100644 --- a/hyrax/app/models/user.rb +++ b/hyrax/app/models/user.rb @@ -61,6 +61,14 @@ class User < ApplicationRecord roles.where(name: "publication_manager").any? end + def can_tombstone?(presenter) + self.admin? + end + + def is_depositor_for?(presenter) + presenter.depositor == self.user_key + end + def self.from_omniauth_orcid(auth) if ENV.fetch('ORCID_RESTRICT_AUTHORIZATION', 'true') == 'true' full_orcid = auth.uid @@ -116,12 +124,80 @@ class User < ApplicationRecord # user.skip_confirmation! end - def can_tombstone?(presenter) - self.admin? + def self.assign_user_to_role(user, user_hash) + role_name = user_hash.fetch('role', nil) + group_id = user_hash.fetch('group_id', nil) + return true, '' if role_name.blank? + + role = if %w(admin publication_manager crc_1280_manager crc_1280_member).include?(role_name) + Role.find_or_create_by(name: role_name) + elsif role_name == "crc_1280_group_manager" and group_id.present? + Role.find_or_create_by(name: "crc_1280_#{group_id}_manager") + elsif role_name == "crc_1280_group_member" and group_id.present? + Role.find_or_create_by(name: "crc_1280_#{group_id}_member") + end + + unless role.present? + if %w(crc_1280_group_manager crc_1280_group_member).include?(role_name) and group_id.blank? + return false, "Error: #{role_name} needs a group id" + else + return false, "Error: #{role_name} is not a valid role" + end + end + + role.users << user if role.users.where(id: user.id).blank? + role.save + return true, "Assigned user #{user.email} role #{role.name}" end - def is_depositor_for?(presenter) - presenter.depositor == self.user_key + def self.find_by_hash(user_hash) + user = nil + if user_hash.fetch('email', nil).present? + user = User.find_by(email: user_hash['email']) + elsif user_hash.fetch('saml_id', nil).present? + user = User.find_by(provider: "saml", uid: user_hash['saml_id']) + elsif user_hash.fetch('orcid', nil).present? + orcid = user_hash['orcid'] + orcid = "https://orcid.org/#{user_hash['orcid']}" unless orcid.start_with?("https://orcid.org/") + user = User.find_by(orcid: orcid) + end + user + end + + def self.find_or_create_user_email(user_hash) + email = nil + if user_hash.fetch('email', nil).present? + email = user_hash['email'] + elsif user_hash.fetch('saml_id', nil).present? + email = user_hash['saml_id'] + email = "#{user_hash['saml_id']}@saml" unless user_hash['saml_id'].include?('@') + elsif user_hash.fetch('orcid', nil).present? + email = "#{user_hash['orcid']}@orcid" + end + email + end + + def self.find_or_create_publication_manager + user_hash = { + "email": ENV.fetch('SYSTEM_PUBLICATION_MANAGER', 'publication_manager@hyrax'), + "name": "Publication Manager", + "role": "publication_manager" + } + user = User.find_by_hash(user_hash) + if user.blank? + user = User.new + user.email = user_hash['email'] + user.password = SecureRandom.random_bytes(32) + user.display_name = user_hash["name"] + if user.save + _success, message = self.assign_user_to_role(user, user_hash) + return true, "Created user #{user_hash['email']}. #{message}", user + else + return false, "Error: #{user.errors.full_messages}", nil + end + else + return true, "Found user #{user_hash['email']}", user + end end end diff --git a/hyrax/app/services/hyrax/workflow/make_visibility_public.rb b/hyrax/app/services/hyrax/workflow/make_visibility_public.rb new file mode 100644 index 00000000..c8f2ad94 --- /dev/null +++ b/hyrax/app/services/hyrax/workflow/make_visibility_public.rb @@ -0,0 +1,13 @@ +module Hyrax + module Workflow + ## + # This is a built in function for workflow, so that a workflow action can be created that + # Transfer Ownership for dataset + module MakeVisibilityPublic + def self.call(target:, **) + target.update(visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC) + Hyrax::VisibilityCopyJob.perform_later(target) + end + end + end +end diff --git a/hyrax/app/services/hyrax/workflow/transfer_ownership.rb b/hyrax/app/services/hyrax/workflow/transfer_ownership.rb index 19583a54..dc8e4938 100644 --- a/hyrax/app/services/hyrax/workflow/transfer_ownership.rb +++ b/hyrax/app/services/hyrax/workflow/transfer_ownership.rb @@ -4,8 +4,9 @@ module Hyrax # This is a built in function for workflow, so that a workflow action can be created that # Transfer Ownership for dataset module TransferOwnership - def self.call(target:, user:, **) - Hyrax::ChangeDepositorService.call(target, user, false) + def self.call(target:, **) + status, _message, user = User.find_or_create_publication_manager + Hyrax::ChangeDepositorService.call(target, user, false) if status and user.present? end end end diff --git a/hyrax/config/workflows/three_step_mediated_deposit_workflow.json b/hyrax/config/workflows/crc_1280_publication_workflow.json similarity index 99% rename from hyrax/config/workflows/three_step_mediated_deposit_workflow.json rename to hyrax/config/workflows/crc_1280_publication_workflow.json index 92938eb5..439d5cf7 100644 --- a/hyrax/config/workflows/three_step_mediated_deposit_workflow.json +++ b/hyrax/config/workflows/crc_1280_publication_workflow.json @@ -1,8 +1,8 @@ { "workflows": [ { - "name": "three_step_mediated_deposit", - "label": "Three-step mediated deposit workflow", + "name": "crc_1280_publication_workflow", + "label": "CRC 1280 publication workflow", "description": "A three-step workflow for mediated deposit in which all deposits must be approved by a reviewer. Reviewer may also send deposits back to the depositor.", "allows_access_grant": false, "actions": [ diff --git a/hyrax/config/workflows/default_workflow.json b/hyrax/config/workflows/default_workflow.json deleted file mode 100644 index c0a8d0ea..00000000 --- a/hyrax/config/workflows/default_workflow.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "workflows": [ - { - "name": "default", - "label": "Default workflow", - "description": "A single submission step, default workflow", - "allows_access_grant": true, - "actions": [ - { - "name": "deposit", - "from_states": [], - "transition_to": "deposited", - "methods": [ - "Hyrax::Workflow::GrantEditToDepositor", - "Hyrax::Workflow::ActivateObject" - ] - } - ] - } - ] -} diff --git a/hyrax/config/workflows/mediated_deposit_workflow.json b/hyrax/config/workflows/mediated_deposit_workflow.json deleted file mode 100644 index d31256e8..00000000 --- a/hyrax/config/workflows/mediated_deposit_workflow.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "workflows": [ - { - "name": "one_step_mediated_deposit", - "label": "One-step mediated deposit workflow", - "description": "A single-step workflow for mediated deposit in which all deposits must be approved by a reviewer. Reviewer may also send deposits back to the depositor.", - "allows_access_grant": false, - "actions": [ - { - "name": "deposit", - "from_states": [], - "transition_to": "pending_review", - "notifications": [ - { - "notification_type": "email", - "name": "Hyrax::Workflow::PendingReviewNotification", - "to": [ - "approving" - ] - } - ], - "methods": [ - "Hyrax::Workflow::GrantReadToDepositor", - "Hyrax::Workflow::DeactivateObject" - ] - }, - { - "name": "request_changes", - "from_states": [ - { - "names": [ - "deposited", - "pending_review" - ], - "roles": [ - "approving" - ] - } - ], - "transition_to": "changes_required", - "notifications": [ - { - "notification_type": "email", - "name": "Hyrax::Workflow::ChangesRequiredNotification", - "to": [ - "approving" - ] - } - ], - "methods": [ - "Hyrax::Workflow::DeactivateObject", - "Hyrax::Workflow::GrantEditToDepositor" - ] - }, - { - "name": "approve", - "from_states": [ - { - "names": [ - "pending_review" - ], - "roles": [ - "approving" - ] - } - ], - "transition_to": "deposited", - "notifications": [ - { - "notification_type": "email", - "name": "Hyrax::Workflow::DepositedNotification", - "to": [ - "approving" - ] - } - ], - "methods": [ - "Hyrax::Workflow::GrantReadToDepositor", - "Hyrax::Workflow::RevokeEditFromDepositor", - "Hyrax::Workflow::ActivateObject" - ] - }, - { - "name": "request_review", - "from_states": [ - { - "names": [ - "changes_required" - ], - "roles": [ - "depositing" - ] - } - ], - "transition_to": "pending_review", - "notifications": [ - { - "notification_type": "email", - "name": "Hyrax::Workflow::PendingReviewNotification", - "to": [ - "approving" - ] - } - ] - }, - { - "name": "comment_only", - "from_states": [ - { - "names": [ - "pending_review", - "deposited" - ], - "roles": [ - "approving" - ] - }, - { - "names": [ - "changes_required" - ], - "roles": [ - "depositing" - ] - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/hyrax/config/workflows/one_step_mediated_deposit_workflow.json b/hyrax/config/workflows/rub_publication_workflow.json similarity index 93% rename from hyrax/config/workflows/one_step_mediated_deposit_workflow.json rename to hyrax/config/workflows/rub_publication_workflow.json index 754f3225..1abaece4 100644 --- a/hyrax/config/workflows/one_step_mediated_deposit_workflow.json +++ b/hyrax/config/workflows/rub_publication_workflow.json @@ -104,8 +104,9 @@ ], "methods": [ "Hyrax::Workflow::GrantEditToDepositor", - "Hyrax::Workflow::GrantReadToPublicationManager", - "Hyrax::Workflow::DeactivateObject" + "Hyrax::Workflow::GrantEditToPublicationManager", + "Hyrax::Workflow::ActivateObject", + "Hyrax::Workflow::TransferOwnership" ] }, { @@ -133,11 +134,12 @@ ], "methods": [ "Hyrax::Workflow::GrantReadToDepositor", - "Hyrax::Workflow::RevokeEditFromDepositor", - "Hyrax::Workflow::GrantReadToPublicationManager", - "Hyrax::Workflow::ActivateObject", + "Hyrax::Workflow::RevokeEditFromDepositor", + "Hyrax::Workflow::GrantEditToPublicationManager", + "Hyrax::Workflow::ActivateObject", "Hyrax::Workflow::RegisterDoi", - "Hyrax::Workflow::TransferOwnership" + "Hyrax::Workflow::TransferOwnership", + "Hyrax::Workflow::MakeVisibilityPublic" ] }, { @@ -261,4 +263,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/hyrax/lib/tasks/create_publication_manager.rake b/hyrax/lib/tasks/create_publication_manager.rake new file mode 100644 index 00000000..ec72f8b9 --- /dev/null +++ b/hyrax/lib/tasks/create_publication_manager.rake @@ -0,0 +1,9 @@ +namespace :rdms do + namespace :publication_manager do + desc 'Create system publication manager' + task :create => :environment do + _success, message, _user = User.find_or_create_publication_manager + puts message + end + end +end diff --git a/hyrax/lib/tasks/setup_hyrax.rake b/hyrax/lib/tasks/setup_hyrax.rake index e8fe880f..332469b8 100644 --- a/hyrax/lib/tasks/setup_hyrax.rake +++ b/hyrax/lib/tasks/setup_hyrax.rake @@ -13,7 +13,7 @@ namespace :rdms do if (File.exists?(seedfile)) Rake::Task["rdms:setup_users"].invoke(seedfile, false) end - + Rake::Task['rdms:publication_manager:create'].invoke ###### # finished creating users ############################################## diff --git a/hyrax/lib/tasks/setup_users.rake b/hyrax/lib/tasks/setup_users.rake index ed6e1f66..04eb808d 100644 --- a/hyrax/lib/tasks/setup_users.rake +++ b/hyrax/lib/tasks/setup_users.rake @@ -23,28 +23,11 @@ namespace :rdms do seed.fetch('users', []).each_with_index do |parsed_user, index| messages = [] user_count = index + 1 - email = nil - user = nil - if parsed_user.fetch('email', nil).present? - user = User.find_by(email: parsed_user['email']) - email = parsed_user['email'] - elsif parsed_user.fetch('saml_id', nil).present? - user = User.find_by(provider: "saml", uid: parsed_user['saml_id']) - if user.present? - email = user.email - else - email = parsed_user['saml_id'] - email = "#{parsed_user['saml_id']}@saml" unless parsed_user['saml_id'].include?('@') - end - elsif parsed_user.fetch('orcid', nil).present? - orcid = parsed_user['orcid'] - orcid = "https://orcid.org/#{parsed_user['orcid']}" unless orcid.start_with?("https://orcid.org/") - user = User.find_by(orcid: orcid) - if user.present? - email = user.email - else - email = "#{parsed_user['orcid']}@orcid" - end + user = User.find_by_hash(parsed_user) + if user + email = user.email + else + email = User.find_or_create_user_email(parsed_user) end if user @@ -56,9 +39,6 @@ namespace :rdms do end elsif email.blank? messages << "Error: Not creating user #{user_count}. User has no email, saml_id or orcid." - elsif parsed_user.fetch('saml_id', nil).blank? and - parsed_user.fetch('orcid', nil).blank? and parsed_user.fetch('password', nil).blank? - messages << "Error: Not creating user #{email}. User has no password, saml_id or orcid." else messages << "Info: Creating user #{email}" user = User.new @@ -69,7 +49,7 @@ namespace :rdms do if parsed_user.fetch('password', nil).present? user.password = parsed_user['password'] - else + elsif user.password.blank? user.password = SecureRandom.random_bytes(32) end @@ -83,7 +63,7 @@ namespace :rdms do user.orcid = parsed_user['orcid'] if parsed_user.fetch('orcid', nil).present? if user.save - _success, message = assign_user_to_role(user, parsed_user) + _success, message = User.assign_user_to_role(user, parsed_user) messages << message else messages << "Error: #{user.errors.full_messages}" @@ -97,31 +77,6 @@ namespace :rdms do end end - def assign_user_to_role(user, parsed_user) - role_name = parsed_user.fetch('role', nil) - group_id = parsed_user.fetch('group_id', nil) - return true, '' if role_name.blank? - - role = if %w(admin publication_manager crc_1280_manager crc_1280_member).include?(role_name) - Role.find_or_create_by(name: role_name) - elsif role_name == "crc_1280_group_manager" and group_id.present? - Role.find_or_create_by(name: "crc_1280_#{group_id}_manager") - elsif role_name == "crc_1280_group_member" and group_id.present? - Role.find_or_create_by(name: "crc_1280_#{group_id}_member") - end - - unless role.present? - if %w(crc_1280_group_manager crc_1280_group_member).include?(role_name) and group_id.blank? - return false, "Error: #{role_name} needs a group id" - else - return false, "Error: #{role_name} is not a valid role" - end - end - - role.users << user if role.users.where(id: user.id).blank? - - return true, "Assigned user #{user.email} role #{role.name}" - end end # Example json file -- GitLab From 9ee4e3634b75a3babdf054a55c0bbe9f8a615607 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Fri, 28 Apr 2023 09:09:37 +0100 Subject: [PATCH 26/37] Return only doi --- hyrax/app/models/doi.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyrax/app/models/doi.rb b/hyrax/app/models/doi.rb index 7d78764e..91099d4f 100644 --- a/hyrax/app/models/doi.rb +++ b/hyrax/app/models/doi.rb @@ -30,7 +30,7 @@ class DOI end def label - "doi:#{@identifier}" + @identifier end def self.match_doi_prefix(value) -- GitLab From 2c87d0625f5c6adad2797be5322a1b2ffdea0bf8 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Fri, 28 Apr 2023 09:12:41 +0100 Subject: [PATCH 27/37] Display citation and share links only for published works --- hyrax/app/views/hyrax/datasets/show.html.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hyrax/app/views/hyrax/datasets/show.html.erb b/hyrax/app/views/hyrax/datasets/show.html.erb index 18ed39b7..706676e5 100644 --- a/hyrax/app/views/hyrax/datasets/show.html.erb +++ b/hyrax/app/views/hyrax/datasets/show.html.erb @@ -19,7 +19,7 @@ </div> <% end %> <div class="col-sm-3 text-center"> - <% if ['deposited', 'published'].include?(@presenter.workflow.state) %> + <% if ['published',].include?(@presenter.workflow.state) %> <%= render 'download_all', presenter: @presenter %> <%= render 'citations', presenter: @presenter %> <%= render 'social_media' %> @@ -56,10 +56,10 @@ <%# = render 'user_activity', presenter: @presenter %> <span class='hide analytics-event' data-category="work" data-action="work-view" data-name="<%= @presenter.id %>" > -<% @presenter.member_of_collection_ids.each do |collection_id| %> - <span class='hide analytics-event' data-category="work-in-collection" data-action="work-in-collection-view" data-name="<%= collection_id %>" > -<% end %> - + <% @presenter.member_of_collection_ids.each do |collection_id| %> + <span class='hide analytics-event' data-category="work-in-collection" data-action="work-in-collection-view" data-name="<%= collection_id %>"/> + <% end %> + </span> </div> </div> -- GitLab From 6a87640a04b218f1ac53a92886fdea4e348acf9c Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Fri, 28 Apr 2023 10:16:09 +0100 Subject: [PATCH 28/37] Formatting fix --- hyrax/config/workflows/rub_publication_workflow.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hyrax/config/workflows/rub_publication_workflow.json b/hyrax/config/workflows/rub_publication_workflow.json index 1abaece4..449a94a5 100644 --- a/hyrax/config/workflows/rub_publication_workflow.json +++ b/hyrax/config/workflows/rub_publication_workflow.json @@ -134,9 +134,9 @@ ], "methods": [ "Hyrax::Workflow::GrantReadToDepositor", - "Hyrax::Workflow::RevokeEditFromDepositor", + "Hyrax::Workflow::RevokeEditFromDepositor", "Hyrax::Workflow::GrantEditToPublicationManager", - "Hyrax::Workflow::ActivateObject", + "Hyrax::Workflow::ActivateObject", "Hyrax::Workflow::RegisterDoi", "Hyrax::Workflow::TransferOwnership", "Hyrax::Workflow::MakeVisibilityPublic" -- GitLab From f36ab21f472a002fd8ad81f9f4a55c1f929833ad Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Fri, 28 Apr 2023 11:36:28 +0100 Subject: [PATCH 29/37] Added workflow names to .env.template --- .env.template | 5 ++++- .env.template.development | 14 +++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.env.template b/.env.template index 2a05bc74..b6de044d 100644 --- a/.env.template +++ b/.env.template @@ -169,5 +169,8 @@ ARK_NAAN= DOWNLOAD_SIZE_LIMIT=100000000 DOWNLOAD_PATH=tmp/downloads +RUB_ADMIN_SET_TITLE="RUB publication workflow" +CRC_ADMIN_SET_TITLE="CRC 1280 Publishing Workflow" + # System user with role publication manager -SYSTEM_PUBLICATION_MANAGER=publication_manager@hyrax \ No newline at end of file +SYSTEM_PUBLICATION_MANAGER=publication_manager@hyrax diff --git a/.env.template.development b/.env.template.development index 70914542..5b6364ed 100644 --- a/.env.template.development +++ b/.env.template.development @@ -150,6 +150,13 @@ ORCID_SANDBOX=true # If Authorization is restricted, only existing users with an Orcid are allowed access ORCID_RESTRICT_AUTHORIZATION=true +# DOI +REGISTER_DOI=false +DOI_URL= +DOI_USERNAME= +DOI_PASSWORD= +DOI_PREFIX= + # ARK REGISTER_ARK=false ARK_ENDPOINT= @@ -159,13 +166,6 @@ ARK_NAMESPACE= # ARK name assigning authority number ARK_NAAN= -# DOI -REGISTER_DOI=false -DOI_URL= -DOI_USERNAME= -DOI_PASSWORD= -DOI_PREFIX= - # Download DOWNLOAD_SIZE_LIMIT=100000000 DOWNLOAD_PATH=tmp/downloads -- GitLab From 0b7f00f6cbef4227d5036a03a3d0191c6624d452 Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Fri, 28 Apr 2023 16:34:28 +0530 Subject: [PATCH 30/37] update rake task with new workflow name --- hyrax/lib/tasks/default_admin_set_for_workflow.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyrax/lib/tasks/default_admin_set_for_workflow.rake b/hyrax/lib/tasks/default_admin_set_for_workflow.rake index 83658bb6..6ced8e1d 100644 --- a/hyrax/lib/tasks/default_admin_set_for_workflow.rake +++ b/hyrax/lib/tasks/default_admin_set_for_workflow.rake @@ -18,7 +18,7 @@ namespace :hyrax do Hyrax::AdminSetCreateService.call(admin_set: admin_set, creating_user: admin_user) - workflow_name = title == rub_default_admin_set_title ? 'rub_publication_workflow' : 'three_step_mediated_deposit' + workflow_name = title == rub_default_admin_set_title ? 'rub_publication_workflow' : 'crc_1280_publication_workflow' mediated_workflow = admin_set.permission_template.available_workflows.where(name: workflow_name).first -- GitLab From 95a8586a29d06ad8f0a46c8871952c1907d7cc93 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Sat, 29 Apr 2023 09:44:48 +0100 Subject: [PATCH 31/37] Keep admin set name consistent --- .env.template | 3 ++- .env.template.development | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.env.template b/.env.template index b6de044d..dee61c4a 100644 --- a/.env.template +++ b/.env.template @@ -169,8 +169,9 @@ ARK_NAAN= DOWNLOAD_SIZE_LIMIT=100000000 DOWNLOAD_PATH=tmp/downloads +# Admin set titles for the workflows RUB_ADMIN_SET_TITLE="RUB publication workflow" -CRC_ADMIN_SET_TITLE="CRC 1280 Publishing Workflow" +CRC_ADMIN_SET_TITLE="CRC 1280 publication Workflow" # System user with role publication manager SYSTEM_PUBLICATION_MANAGER=publication_manager@hyrax diff --git a/.env.template.development b/.env.template.development index 5b6364ed..840bd371 100644 --- a/.env.template.development +++ b/.env.template.development @@ -170,8 +170,9 @@ ARK_NAAN= DOWNLOAD_SIZE_LIMIT=100000000 DOWNLOAD_PATH=tmp/downloads +# Admin set titles for the workflows RUB_ADMIN_SET_TITLE="RUB publication workflow" -CRC_ADMIN_SET_TITLE="CRC 1280 Publishing Workflow" +CRC_ADMIN_SET_TITLE="CRC 1280 publication Workflow" # System user with role publication manager SYSTEM_PUBLICATION_MANAGER=publication_manager@hyrax -- GitLab From 56555d4b17977466d6ad6405361bd37ea1e79cd5 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Sat, 29 Apr 2023 09:45:03 +0100 Subject: [PATCH 32/37] Fix for system stack error --- hyrax/app/models/concerns/external_services.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyrax/app/models/concerns/external_services.rb b/hyrax/app/models/concerns/external_services.rb index d5a1168e..70b290d5 100644 --- a/hyrax/app/models/concerns/external_services.rb +++ b/hyrax/app/models/concerns/external_services.rb @@ -41,7 +41,7 @@ module ExternalServices s3.init_client bucket_name = s3.sanitise_name(id) s3.create_bucket(bucket_name) unless s3.bucket_exists?(bucket_name) - s3.add_content(bucket_name, 'metadata.json', to_json) + s3.add_content(bucket_name, 'metadata.json', self.class.find(self.id).to_json) end end -- GitLab From 7f4996be44d49262e66c2af5c457949a0f7cdd2e Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Sat, 29 Apr 2023 09:46:33 +0100 Subject: [PATCH 33/37] Workflow tweaks and better messaging for user --- hyrax/app/models/user.rb | 3 + .../hyrax/workflow/draft_notification.rb | 23 +++++ .../hyrax/workflow/transfer_ownership.rb | 2 +- .../views/hyrax/base/_show_actions.html.erb | 6 +- .../hyrax/base/_workflow_actions.html.erb | 40 +++++++++ hyrax/config/initializers/hyrax.rb | 2 +- hyrax/config/locales/crc_dataset.en.yml | 3 + hyrax/config/locales/dataset.en.yml | 3 + hyrax/config/locales/hyrax.en.yml | 3 + .../workflows/rub_publication_workflow.json | 84 ++++++++++--------- 10 files changed, 126 insertions(+), 43 deletions(-) create mode 100644 hyrax/app/services/hyrax/workflow/draft_notification.rb create mode 100644 hyrax/app/views/hyrax/base/_workflow_actions.html.erb diff --git a/hyrax/app/models/user.rb b/hyrax/app/models/user.rb index c607faf3..d2313845 100644 --- a/hyrax/app/models/user.rb +++ b/hyrax/app/models/user.rb @@ -125,6 +125,7 @@ class User < ApplicationRecord end def self.assign_user_to_role(user, user_hash) + user_hash = ActiveSupport::HashWithIndifferentAccess.new(user_hash) role_name = user_hash.fetch('role', nil) group_id = user_hash.fetch('group_id', nil) return true, '' if role_name.blank? @@ -151,6 +152,7 @@ class User < ApplicationRecord end def self.find_by_hash(user_hash) + user_hash = ActiveSupport::HashWithIndifferentAccess.new(user_hash) user = nil if user_hash.fetch('email', nil).present? user = User.find_by(email: user_hash['email']) @@ -165,6 +167,7 @@ class User < ApplicationRecord end def self.find_or_create_user_email(user_hash) + user_hash = ActiveSupport::HashWithIndifferentAccess.new(user_hash) email = nil if user_hash.fetch('email', nil).present? email = user_hash['email'] diff --git a/hyrax/app/services/hyrax/workflow/draft_notification.rb b/hyrax/app/services/hyrax/workflow/draft_notification.rb new file mode 100644 index 00000000..756ed30e --- /dev/null +++ b/hyrax/app/services/hyrax/workflow/draft_notification.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Hyrax + module Workflow + class DraftNotification < AbstractNotification + private + + def subject + I18n.t('hyrax.notifications.workflow.draft.subject') + end + + def message + I18n.t('hyrax.notifications.workflow.draft.message', title: title, + link: (link_to work_id, document_path), + user: user.user_key, comment: comment) + end + + def users_to_notify + [::User.find_by(email: document.depositor)] + end + end + end +end diff --git a/hyrax/app/services/hyrax/workflow/transfer_ownership.rb b/hyrax/app/services/hyrax/workflow/transfer_ownership.rb index dc8e4938..3da6b297 100644 --- a/hyrax/app/services/hyrax/workflow/transfer_ownership.rb +++ b/hyrax/app/services/hyrax/workflow/transfer_ownership.rb @@ -5,7 +5,7 @@ module Hyrax # Transfer Ownership for dataset module TransferOwnership def self.call(target:, **) - status, _message, user = User.find_or_create_publication_manager + status, _message, user = ::User.find_or_create_publication_manager Hyrax::ChangeDepositorService.call(target, user, false) if status and user.present? end end diff --git a/hyrax/app/views/hyrax/base/_show_actions.html.erb b/hyrax/app/views/hyrax/base/_show_actions.html.erb index 2a99963c..adeead63 100644 --- a/hyrax/app/views/hyrax/base/_show_actions.html.erb +++ b/hyrax/app/views/hyrax/base/_show_actions.html.erb @@ -26,8 +26,8 @@ <% unless is_permanently_tombstoned?(presenter) %> <div class="col-sm-6 text-right"> - <% if presenter.editor? && !workflow_restriction?(presenter) && !current_user.publication_manager? %> - <% unless is_published?(presenter) || is_archived?(presenter) %> + <% if presenter.editor? && !workflow_restriction?(presenter) %> + <%# unless is_published?(presenter) || is_archived?(presenter) %> <%= link_to t('.edit'), edit_polymorphic_path([main_app, presenter]), class: 'btn btn-secondary' %> <% if presenter.member_count > 1 %> @@ -49,7 +49,7 @@ <% end %> <%= link_to t('.delete'), [main_app, presenter], class: 'btn btn-danger', data: { confirm: t('.confirm_delete', work_type: presenter.human_readable_type) }, method: :delete %> - <% end %> + <%# end %> <% end %> </div> <% end %> diff --git a/hyrax/app/views/hyrax/base/_workflow_actions.html.erb b/hyrax/app/views/hyrax/base/_workflow_actions.html.erb new file mode 100644 index 00000000..444c7e7a --- /dev/null +++ b/hyrax/app/views/hyrax/base/_workflow_actions.html.erb @@ -0,0 +1,40 @@ +<div id="workflow_controls" class="panel panel-workflow"> + <div class="panel-heading"> + <a data-toggle="collapse" href="#workflow_controls_collapse"> + <h2 class="panel-title"><%= t('.title') %> <span class="fa fa-chevron-right pull-right"></span></h2> + </a> + </div> + <%= form_tag main_app.hyrax_workflow_action_path(presenter), method: :put do %> + <div id="workflow_controls_collapse" class="panel-body panel-collapse collapse"> + <div class="col-sm-3 workflow-actions"> + <h3><%= t('.actions') %></h3> + + <% presenter.workflow.actions.each do |key, label| %> + <div class="radio"> + <label> + <%= radio_button_tag 'workflow_action[name]', key, key == 'comment_only' %> + <%= label %> + </label> + </div> + <% end %> + </div> + <div class="col-sm-9 workflow-comments"> + <div class="form-group"> + <label for="workflow_action_comment"><%= t('.review_comment') %>:</label> + <div><%= t('.review_comment_text') %></div> + <textarea class="form-control" name="workflow_action[comment]" id="workflow_action_comment"></textarea> + </div> + + <input class="btn btn-primary" type="submit" value="Submit" /> + + <h4><%= t('.previous_comments') %></h4> + <dl> + <% presenter.workflow.comments.each do |comment| %> + <dt><%= comment.name_of_commentor %></dt> + <dd><%= comment.comment %></dd> + <% end %> + </dl> + </div> + </div> + <% end %> +</div> \ No newline at end of file diff --git a/hyrax/config/initializers/hyrax.rb b/hyrax/config/initializers/hyrax.rb index b5023c50..7acfa8c6 100644 --- a/hyrax/config/initializers/hyrax.rb +++ b/hyrax/config/initializers/hyrax.rb @@ -14,7 +14,7 @@ Hyrax.config do |config| # When an admin set is created, we need to activate a workflow. # The :default_active_workflow_name is the name of the workflow we will activate. # @see Hyrax::Configuration for additional details and defaults. - # config.default_active_workflow_name = 'default' + config.default_active_workflow_name = 'rub_publication_workflow' # Which RDF term should be used to relate objects to an admin set? # If this is a new repository, you may want to set a custom predicate term here to diff --git a/hyrax/config/locales/crc_dataset.en.yml b/hyrax/config/locales/crc_dataset.en.yml index fbcea096..47e57156 100644 --- a/hyrax/config/locales/crc_dataset.en.yml +++ b/hyrax/config/locales/crc_dataset.en.yml @@ -1,5 +1,8 @@ en: hyrax: + base: + workflow_actions: + review_comment_text: "Let the CRC manager know if you would like the dataset to be published or archived." icons: crc_dataset: 'fa fa-file-text-o' select_type: diff --git a/hyrax/config/locales/dataset.en.yml b/hyrax/config/locales/dataset.en.yml index 9f8c528d..aa9103fa 100644 --- a/hyrax/config/locales/dataset.en.yml +++ b/hyrax/config/locales/dataset.en.yml @@ -1,5 +1,8 @@ en: hyrax: + base: + workflow_actions: + review_comment_text: "Let the reviewer know if you would like the dataset to be published or archived." icons: dataset: 'fa fa-file-text-o' select_type: diff --git a/hyrax/config/locales/hyrax.en.yml b/hyrax/config/locales/hyrax.en.yml index 2b3c768a..ab2c05cc 100644 --- a/hyrax/config/locales/hyrax.en.yml +++ b/hyrax/config/locales/hyrax.en.yml @@ -449,6 +449,9 @@ en: %{title} (%{link}) requires additional changes before approval. '%{comment}' subject: Deposit requires changes + draft: + message: "You have created the dataset %{title} (%{link}). You can edit and make changes to the dataset. When ready, click on deposit in the `Review and Approval` section. Add a comment to let a reviewer know if you would like the dataset to be archived or published." + subject: "We have your new dataset" sent_for_review: message: "Deposit %{title} (%{link}) has been sent to %{approval_from} for approval. %{comment}" subject: "Deposit sent for review" diff --git a/hyrax/config/workflows/rub_publication_workflow.json b/hyrax/config/workflows/rub_publication_workflow.json index 449a94a5..c888ff4d 100644 --- a/hyrax/config/workflows/rub_publication_workflow.json +++ b/hyrax/config/workflows/rub_publication_workflow.json @@ -10,7 +10,15 @@ "name": "draft", "from_states": [], "transition_to": "draft", - "notifications": [], + "notifications": [ + { + "notification_type": "email", + "name": "Hyrax::Workflow::DraftNotification", + "to": [ + "depositor" + ] + } + ], "methods": [ "Hyrax::Workflow::GrantEditToDepositor", "Hyrax::Workflow::DeactivateObject" @@ -48,8 +56,7 @@ "methods": [ "Hyrax::Workflow::GrantReadToDepositor", "Hyrax::Workflow::RevokeEditFromDepositor", - "Hyrax::Workflow::GrantReadToPublicationManager", - "Hyrax::Workflow::DeactivateObject" + "Hyrax::Workflow::GrantReadToPublicationManager" ] }, { @@ -76,41 +83,46 @@ ], "methods": [ "Hyrax::Workflow::GrantEditToDepositor", - "Hyrax::Workflow::GrantReadToPublicationManager", - "Hyrax::Workflow::DeactivateObject" + "Hyrax::Workflow::GrantReadToPublicationManager" ] }, { - "name": "archive_from_publication_manager", + "name": "request_review_to_publication_manager", "from_states": [ { "names": [ - "pending_review_from_publication_manager" + "changes_required_from_publication_manager" ], "roles": [ - "approving_publication_manager" + "depositing" ] } ], - "transition_to": "archived", + "transition_to": "pending_review_from_publication_manager", "notifications": [ { "notification_type": "email", - "name": "Hyrax::Workflow::ArchiveNotification", + "name": "Hyrax::Workflow::SentForReview::DepositorNotification", "to": [ "depositor" ] + }, + { + "notification_type": "email", + "name": "Hyrax::Workflow::PendingReview::PublicationManagerNotification", + "to": [ + "approving_publication_manager" + ] } ], "methods": [ - "Hyrax::Workflow::GrantEditToDepositor", - "Hyrax::Workflow::GrantEditToPublicationManager", - "Hyrax::Workflow::ActivateObject", - "Hyrax::Workflow::TransferOwnership" + "Hyrax::Workflow::GrantReadToDepositor", + "Hyrax::Workflow::RevokeEditFromDepositor", + "Hyrax::Workflow::DeactivateObject" ] }, { - "name": "approval_from_publication_manager", + "name": "archive_from_publication_manager", "from_states": [ { "names": [ @@ -121,14 +133,13 @@ ] } ], - "transition_to": "published", + "transition_to": "archived", "notifications": [ { "notification_type": "email", - "name": "Hyrax::Workflow::DepositedNotification", + "name": "Hyrax::Workflow::ArchiveNotification", "to": [ - "depositor", - "approving_publication_manager" + "depositor" ] } ], @@ -137,36 +148,28 @@ "Hyrax::Workflow::RevokeEditFromDepositor", "Hyrax::Workflow::GrantEditToPublicationManager", "Hyrax::Workflow::ActivateObject", - "Hyrax::Workflow::RegisterDoi", - "Hyrax::Workflow::TransferOwnership", - "Hyrax::Workflow::MakeVisibilityPublic" + "Hyrax::Workflow::TransferOwnership" ] }, { - "name": "request_review_to_publication_manager", + "name": "approval_from_publication_manager", "from_states": [ { "names": [ - "changes_required_from_publication_manager" + "pending_review_from_publication_manager" ], "roles": [ - "depositing" + "approving_publication_manager" ] } ], - "transition_to": "pending_review_from_publication_manager", + "transition_to": "published", "notifications": [ { "notification_type": "email", - "name": "Hyrax::Workflow::SentForReview::DepositorNotification", - "to": [ - "depositor" - ] - }, - { - "notification_type": "email", - "name": "Hyrax::Workflow::PendingReview::PublicationManagerNotification", + "name": "Hyrax::Workflow::DepositedNotification", "to": [ + "depositor", "approving_publication_manager" ] } @@ -174,7 +177,12 @@ "methods": [ "Hyrax::Workflow::GrantReadToDepositor", "Hyrax::Workflow::RevokeEditFromDepositor", - "Hyrax::Workflow::DeactivateObject" + "Hyrax::Workflow::GrantReadToPublicationManager", + "Hyrax::Workflow::RevokeEditFromPublicationManager", + "Hyrax::Workflow::ActivateObject", + "Hyrax::Workflow::RegisterDoi", + "Hyrax::Workflow::TransferOwnership", + "Hyrax::Workflow::MakeVisibilityPublic" ] }, { @@ -214,7 +222,7 @@ "published" ], "roles": [ - "depositing" + "approving_publication_manager" ] } ], @@ -232,7 +240,7 @@ "tomstoned_initiated" ], "roles": [ - "depositing" + "approving_publication_manager" ] } ], @@ -250,7 +258,7 @@ "tomstoned_initiated" ], "roles": [ - "depositing" + "approving_publication_manager" ] } ], -- GitLab From e739ef90e762cdcbc3177f280774fca03b887111 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Sat, 29 Apr 2023 10:02:40 +0100 Subject: [PATCH 34/37] Throws not found error in test system --- hyrax/app/services/hyrax/workflow/make_visibility_public.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyrax/app/services/hyrax/workflow/make_visibility_public.rb b/hyrax/app/services/hyrax/workflow/make_visibility_public.rb index c8f2ad94..437cc359 100644 --- a/hyrax/app/services/hyrax/workflow/make_visibility_public.rb +++ b/hyrax/app/services/hyrax/workflow/make_visibility_public.rb @@ -6,7 +6,7 @@ module Hyrax module MakeVisibilityPublic def self.call(target:, **) target.update(visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC) - Hyrax::VisibilityCopyJob.perform_later(target) + ::Hyrax::VisibilityCopyJob.perform_later(target) end end end -- GitLab From 77db72bc3dd72d920541382adabb34890564e5a1 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Sun, 30 Apr 2023 07:40:35 +0100 Subject: [PATCH 35/37] Reverting last change for not found error --- hyrax/app/services/hyrax/workflow/make_visibility_public.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyrax/app/services/hyrax/workflow/make_visibility_public.rb b/hyrax/app/services/hyrax/workflow/make_visibility_public.rb index 437cc359..898793e8 100644 --- a/hyrax/app/services/hyrax/workflow/make_visibility_public.rb +++ b/hyrax/app/services/hyrax/workflow/make_visibility_public.rb @@ -6,7 +6,7 @@ module Hyrax module MakeVisibilityPublic def self.call(target:, **) target.update(visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC) - ::Hyrax::VisibilityCopyJob.perform_later(target) + VisibilityCopyJob.perform_later(target) end end end -- GitLab From 91ceb7df27e65f454b2b5c50376a729a4eae721e Mon Sep 17 00:00:00 2001 From: kapill65chhpatel <kapil@cottagelabs.com> Date: Tue, 2 May 2023 17:47:33 +0530 Subject: [PATCH 36/37] reinstate sharing tab for rub --- hyrax/config/workflows/rub_publication_workflow.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyrax/config/workflows/rub_publication_workflow.json b/hyrax/config/workflows/rub_publication_workflow.json index c888ff4d..73f480bc 100644 --- a/hyrax/config/workflows/rub_publication_workflow.json +++ b/hyrax/config/workflows/rub_publication_workflow.json @@ -4,7 +4,7 @@ "name": "rub_publication_workflow", "label": "RUB publication workflow", "description": "A single-step workflow for mediated deposit in which all deposits must be approved by a reviewer. Reviewer may also send deposits back to the depositor.", - "allows_access_grant": false, + "allows_access_grant": true, "actions": [ { "name": "draft", -- GitLab From d7bc999d73ade2c7f2037680c56deb9b0fe942d2 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Wed, 3 May 2023 09:58:35 +0100 Subject: [PATCH 37/37] Hide admin set dropdown from user --- hyrax/app/views/hyrax/base/_form_relationships.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyrax/app/views/hyrax/base/_form_relationships.html.erb b/hyrax/app/views/hyrax/base/_form_relationships.html.erb index c76dfb31..a9932266 100755 --- a/hyrax/app/views/hyrax/base/_form_relationships.html.erb +++ b/hyrax/app/views/hyrax/base/_form_relationships.html.erb @@ -3,7 +3,7 @@ include_blank: false, collection: admin_set_options, selected: f.object.model.default_admin_set.id, - input_html: { class: 'form-control' } %> + input_html: { class: 'form-control hidden' } %> <% end %> <%= render 'form_in_works', f: f %> -- GitLab