From: Lucas Di Pentima Date: Fri, 10 Jun 2022 14:57:35 +0000 (-0300) Subject: Merge branch '19177-sharing-links-ui-config'. Refs #19177 X-Git-Tag: 2.5.0~139 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/ef35a5388d60e892835309df2b46b221f8df221d?hp=cd8f854549cf8224cfee5b42667869664dcf6e80 Merge branch '19177-sharing-links-ui-config'. Refs #19177 Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/apps/workbench/app/views/collections/show.html.erb b/apps/workbench/app/views/collections/show.html.erb index 56712661c8..8a9200aeba 100644 --- a/apps/workbench/app/views/collections/show.html.erb +++ b/apps/workbench/app/views/collections/show.html.erb @@ -40,13 +40,11 @@ SPDX-License-Identifier: AGPL-3.0 %>
- - + <% if !Rails.configuration.Workbench.DisableSharingURLsUI %>
<%= render partial: 'sharing_button' %>
+ <% end %>
<% if @projects.andand.any? %> diff --git a/apps/workbench/test/integration/collections_test.rb b/apps/workbench/test/integration/collections_test.rb index e7b27fff86..4d6489d4aa 100644 --- a/apps/workbench/test/integration/collections_test.rb +++ b/apps/workbench/test/integration/collections_test.rb @@ -41,11 +41,19 @@ class CollectionsTest < ActionDispatch::IntegrationTest send(link_assertion, all("a").select { |a| a[:href] =~ link_regexp }) end + test "Hides sharing link button when configured to do so" do + Rails.configuration.Workbench.DisableSharingURLsUI = true + coll_uuid = api_fixture("collections", "collection_owned_by_active", "uuid") + visit page_with_token("active_trustedclient", "/collections/#{coll_uuid}") + assert_no_selector 'div#sharing-button' + end + test "creating and uncreating a sharing link" do coll_uuid = api_fixture("collections", "collection_owned_by_active", "uuid") download_link_re = Regexp.new(Regexp.escape("/c=#{coll_uuid}/")) visit page_with_token("active_trustedclient", "/collections/#{coll_uuid}") + assert_selector 'div#sharing-button' within "#sharing-button" do check_sharing(:on, download_link_re) check_sharing(:off, download_link_re) diff --git a/lib/config/config.default.yml b/lib/config/config.default.yml index f6e9910161..a9bbf4eee9 100644 --- a/lib/config/config.default.yml +++ b/lib/config/config.default.yml @@ -1526,6 +1526,11 @@ Clusters: ShowUserAgreementInline: false SecretKeyBase: "" + # Set this configuration to true to avoid providing an easy way for users + # to share data with unauthenticated users; this may be necessary on + # installations where strict data access controls are needed. + DisableSharingURLsUI: false + # Scratch directory used by the remote repository browsing # feature. If it doesn't exist, it (and any missing parents) will be # created using mkdir_p. diff --git a/lib/config/export.go b/lib/config/export.go index 3faa0062fa..a55295d126 100644 --- a/lib/config/export.go +++ b/lib/config/export.go @@ -264,6 +264,7 @@ var whitelist = map[string]bool{ "Workbench.ArvadosDocsite": true, "Workbench.ArvadosPublicDataDocURL": true, "Workbench.DefaultOpenIdPrefix": false, + "Workbench.DisableSharingURLsUI": true, "Workbench.EnableGettingStartedPopup": true, "Workbench.EnablePublicProjectsPage": true, "Workbench.FileViewersConfigURL": true, diff --git a/sdk/go/arvados/config.go b/sdk/go/arvados/config.go index 319fa1a38f..0d8f293124 100644 --- a/sdk/go/arvados/config.go +++ b/sdk/go/arvados/config.go @@ -260,6 +260,7 @@ type Cluster struct { ArvadosDocsite string ArvadosPublicDataDocURL string DefaultOpenIdPrefix string + DisableSharingURLsUI bool EnableGettingStartedPopup bool EnablePublicProjectsPage bool FileViewersConfigURL string