Merge branch '19177-sharing-links-ui-config'. Refs #19177
authorLucas Di Pentima <lucas.dipentima@curii.com>
Fri, 10 Jun 2022 14:57:35 +0000 (11:57 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Fri, 10 Jun 2022 14:57:35 +0000 (11:57 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

apps/workbench/app/views/collections/show.html.erb
apps/workbench/test/integration/collections_test.rb
lib/config/config.default.yml
lib/config/export.go
sdk/go/arvados/config.go

index 56712661c836d2f8c91427e95598978407f9b1bb..8a9200aeba77ee607f080bc7a3dbddffc8d964b7 100644 (file)
@@ -40,13 +40,11 @@ SPDX-License-Identifier: AGPL-3.0 %>
         </h3>
       </div>
       <div class="panel-body">
-        <!--
-        <input type="text" class="form-control" placeholder="Search"/>
-        -->
-
+        <% if !Rails.configuration.Workbench.DisableSharingURLsUI %>
         <div id="sharing-button">
           <%= render partial: 'sharing_button' %>
         </div>
+        <% end %>
 
         <div style="height:0.5em;"></div>
         <% if @projects.andand.any? %>
index e7b27fff86377c4013a216bc897bf1cc7016b7f4..4d6489d4aa3e4b7639469904b9b588fb38ce2a08 100644 (file)
@@ -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)
index f6e99101618fa465530a68addef982c1eed01ab4..a9bbf4eee9b5002e733cb46df5ffe9be995ffdcf 100644 (file)
@@ -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.
index 3faa0062fa9977cab3fc7475fab1e622d88ba027..a55295d1268b7cc0829ec2fe5073eb276c5b4564 100644 (file)
@@ -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,
index 319fa1a38f4a5e1e936315dbacb241f279c04aa6..0d8f293124976cb42f9d009da1b16c5057ba1071 100644 (file)
@@ -260,6 +260,7 @@ type Cluster struct {
                ArvadosDocsite                   string
                ArvadosPublicDataDocURL          string
                DefaultOpenIdPrefix              string
+               DisableSharingURLsUI             bool
                EnableGettingStartedPopup        bool
                EnablePublicProjectsPage         bool
                FileViewersConfigURL             string