From f2060fc946ef2281f7faed62482126b5cacaace8 Mon Sep 17 00:00:00 2001
From: Stuart Owen
- <%= text_for_resource item -%>: <%= link_to item.title, item, :target => "_blank" -%>
- <%=list_item_visibility(item)-%>
-
- <%= text_for_resource item -%>: This item is hidden to you
- <% if current_user.try(:person) && item.can_see_hidden_item?(current_user.person) %>
-
+ <%= text_for_resource item -%>: <%= link_to item.title, item, :target => "_blank" -%>
+ <%=list_item_visibility(item)-%>
+
+ <% else %>
+ <%= text_for_resource item -%>: This item is hidden to you
+ <% unless current_user.try(:person) && item.can_see_hidden_item?(current_user.person) %>
+ <% show_managers=false%>
<% end %>
-
- You can select an item to be published by checking the Publish - checkbox beside that item. + You can select an item to be published by checking the checkbox beside that item.
-8yB-#8R{9B8Y<#kwCgE+S9E#VS{6`~={;@wX4zCbNWq!&E|=H{Vs|C- z4lpjObA91}plD~8cfWXMbsEvxufvE)kP{f#j`&W1g%vylI?f#~Fhd+dQeTSRIM)hQ zcmx_T(Iid9zn!UYa_kz&68d5nWbrEL1uDr0RVt7)A909aP~qIFbX&f z0que&pcT(u^uRaR_PKY%`GXja=$ ?0`ZFmh4ISC} zKB# U+@ nql5?tLhcX zG$QC_yN9+yuYwIlysMRW@s@-M$(}uLAb8}I4~nc#sT2>CuqhjKI~bSEeIiN}OMl0H zv}Y8tPgO`Grq4lEiO X6&k1Q0bSEn?EJn3MIbvGYqQTG&MqQX}pKc^J3m^@? z uxWGesz2Hxv>)%UT#4CaiO1kKLN_DIed> i z-A`9YIp-nTK$lRcm0n2&2LC#g&;Imj Kox?m5!*1qztO?kILj7#pb{Leln1)aC9bwFm~XUp+uNsf?$-N}ze@ z@gl#TIMDp!89>i2ro?m@S$4Eo#WX#EODXPf)3Z28(yM#!NkNIoX%ow(?}bmRlt3zT zh5uEU41MB&DxO^NkG8R`M1AXQi{}f}e{ib!>EJu-67?oBKEt)w;Z8Ze9Lc_<^!1B! zyEq4L&k>q+J3J@Nxhv5B#en8@UQ&4{X;N?(m}V3!w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Z11mu_=!t;mK;Bwu&HceyyM5p|4x<%ST9Rh zll|eI|4n=|kFANXt}kh$_%Fw8O8Mi=Y-X?Z6i&{cGxK8z8_o9rpf;LoJ<59{YO{s^ bWwp)7zwc)@_SHSl$-L#6J4tNy2Lkvvs$=*6 literal 0 HcmV?d00001 diff --git a/test/integration/git_workflow_ro_crate_api_test.rb b/test/integration/git_workflow_ro_crate_api_test.rb index b3b34c5fd9..c7e84558a4 100644 --- a/test/integration/git_workflow_ro_crate_api_test.rb +++ b/test/integration/git_workflow_ro_crate_api_test.rb @@ -103,6 +103,20 @@ class GitWorkflowRoCrateApiTest < ActionDispatch::IntegrationTest end end + test 'can identify license from URI' do + assert_difference('Workflow.count', 1) do + post workflows_path, params: { + ro_crate: fixture_file_upload('workflows/ro-crate-with-uri-license.crate.zip'), + workflow: { + project_ids: [@project.id] + } + } + + assert_response :success + assert_equal 'MIT', assigns(:workflow).license + end + end + private def login_as(user) diff --git a/test/unit/license_test.rb b/test/unit/license_test.rb index c4b250a358..320807399a 100644 --- a/test/unit/license_test.rb +++ b/test/unit/license_test.rb @@ -124,7 +124,7 @@ class LicenseTest < ActiveSupport::TestCase sop.license = 'CCZZ' refute sop.valid? assert_equal 1,sop.errors.count - assert sop.errors.added?(:license, "isn't a valid license ID") + assert sop.errors.added?(:license, "isn't a recognized license") #allow blank sop.license=nil @@ -137,4 +137,26 @@ class LicenseTest < ActiveSupport::TestCase assert sop.valid? end + test 'lookup license ID from URI' do + assert_equal 'CC-BY-4.0', Seek::License.uri_to_id('https://spdx.org/licenses/CC-BY-4.0.html') + assert_equal 'CC-BY-4.0', Seek::License.uri_to_id('https://spdx.org/licenses/CC-BY-4.0') + assert_equal 'CC-BY-4.0', Seek::License.uri_to_id('https://creativecommons.org/licenses/by/4.0/') + assert_equal 'CC-BY-4.0', Seek::License.uri_to_id('https://creativecommons.org/licenses/by/4.0/legalcode') + + assert_equal 'MIT-open-group', Seek::License.uri_to_id('https://gitlab.freedesktop.org/xorg/app/iceauth/-/blob/master/COPYING') + + assert_nil Seek::License.uri_to_id('https://creativecommons.org/licenses/by/5.0') + end + + test 'set license via URI' do + sop = FactoryBot.create(:sop, license: 'https://creativecommons.org/licenses/by/4.0/') + assert sop.valid? + assert_equal 'CC-BY-4.0', sop.license + + sop.license = 'CCZZ' + refute sop.valid? + assert_equal 1,sop.errors.count + assert sop.errors.added?(:license, "isn't a recognized license") + assert_equal 'CCZZ', sop.license + end end From 9f5b507b861c599731601c35cb9be57ce89d8917 Mon Sep 17 00:00:00 2001 From: Finn Bacall Date: Tue, 25 Jul 2023 19:28:57 +0100 Subject: [PATCH 018/383] Test fix --- test/functional/data_files_controller_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functional/data_files_controller_test.rb b/test/functional/data_files_controller_test.rb index abf36b83f9..6f3ab1061f 100644 --- a/test/functional/data_files_controller_test.rb +++ b/test/functional/data_files_controller_test.rb @@ -2132,7 +2132,7 @@ def test_show_item_attributed_to_jerm_file get :edit, params: { id: df } assert_response :success - assert_select '#license-select option[selected=?]', 'selected', text: 'Creative Commons Attribution Share-Alike 4.0' + assert_select '#license-select option[selected=?]', 'selected', text: 'Creative Commons Attribution Share Alike 4.0 International' df2 = FactoryBot.create :data_file, license: nil, policy: FactoryBot.create(:public_policy) @@ -2142,7 +2142,7 @@ def test_show_item_attributed_to_jerm_file register_content_blob assert_response :success - assert_select '#license-select option[selected=?]', 'selected', text: 'Creative Commons Attribution 4.0' + assert_select '#license-select option[selected=?]', 'selected', text: 'Creative Commons Attribution 4.0 International' end test 'can disambiguate sample type' do From db40534c180689189b3b05b186c8d7103fee253c Mon Sep 17 00:00:00 2001 From: fherreazcue Date: Thu, 27 Jul 2023 16:50:33 +0100 Subject: [PATCH 019/383] Uses batch_asset_selection for batch_sharing_permission_preview --- app/helpers/assets_helper.rb | 12 - .../batch_sharing_permission_preview.html.erb | 322 ++---------------- .../sharing_bulk_change_preview.html.erb | 2 +- ...ample_sharing_bulk_change_preview.html.erb | 2 +- lib/seek/publishing/publishing_common.rb | 2 +- lib/seek/sharing/sharing_common.rb | 11 +- 6 files changed, 27 insertions(+), 324 deletions(-) diff --git a/app/helpers/assets_helper.rb b/app/helpers/assets_helper.rb index b3b74a9228..9e79a75ce5 100644 --- a/app/helpers/assets_helper.rb +++ b/app/helpers/assets_helper.rb @@ -94,18 +94,6 @@ def publishing_item_param(item) "publish[#{item.class.name}][#{item.id}]" end - def sharing_item_param(item) - if item.try(:is_isa?) - "share_isa[#{item.class.name}][#{item.id}]" - elsif (item.respond_to? (:investigations)) && (!item.investigations.any?) - "share_not_isa[#{item.class.name}][#{item.id}]" - elsif !item.respond_to? (:investigations) - "share_not_isa[#{item.class.name}][#{item.id}]" - else - "share_isa[#{item.class.name}][#{item.id}]" - end - end - def include_downloadable_item?(items) has_downloadable_item = false items.each do |item| diff --git a/app/views/assets/sharing/batch_sharing_permission_preview.html.erb b/app/views/assets/sharing/batch_sharing_permission_preview.html.erb index 14f8355a67..6c1ebd757e 100644 --- a/app/views/assets/sharing/batch_sharing_permission_preview.html.erb +++ b/app/views/assets/sharing/batch_sharing_permission_preview.html.erb @@ -1,14 +1,4 @@ <% - items_not_in_isa_hash = SharingPermissionsHelper::ITEMS_NOT_IN_ISA_HASH - items_not_in_isa_hash[:children] =[] - - all_investigations_hash = SharingPermissionsHelper::ALL_INVESTIGATIONS_HASH - all_investigations_hash[:children] = [] - - #include items which can change sharing permissions, the 'publication' is intendedly excluded. - all_related_items_hash = get_related_resources(current_user.person).slice(*Seek::Util.authorized_types.map(&:name)).except!('Publication') - - items_not_in_isa = filter_items_not_in_ISA(all_related_items_hash) @policy_params = params[:policy_attributes] @@ -26,296 +16,24 @@