[ARVADOS] updated: 2.1.0-216-g52ddd1b32

Git user git at public.arvados.org
Thu Dec 10 20:59:31 UTC 2020


Summary of changes:
 services/api/app/models/api_client_authorization.rb |  1 -
 services/api/app/models/collection.rb               |  6 ++++++
 services/api/test/fixtures/collections.yml          |  2 +-
 services/api/test/unit/log_test.rb                  | 14 ++++++++++++++
 4 files changed, 21 insertions(+), 2 deletions(-)

       via  52ddd1b322d15a98245ffff4c7dead4e71a14134 (commit)
      from  2bd36032907728b6566a4c1892f55effa4fcbe0a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 52ddd1b322d15a98245ffff4c7dead4e71a14134
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Dec 10 17:58:58 2020 -0300

    17152: Avoids creating audit logs when only 'preserve_version' is updated.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/app/models/api_client_authorization.rb b/services/api/app/models/api_client_authorization.rb
index 6b308a231..9290e01a1 100644
--- a/services/api/app/models/api_client_authorization.rb
+++ b/services/api/app/models/api_client_authorization.rb
@@ -394,7 +394,6 @@ class ApiClientAuthorization < ArvadosModel
   end
 
   def log_update
-
     super unless (saved_changes.keys - UNLOGGED_CHANGES).empty?
   end
 end
diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 919d2fcb4..e3802734a 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -64,6 +64,8 @@ class Collection < ArvadosModel
     t.add :file_size_total
   end
 
+  UNLOGGED_CHANGES = ['preserve_version', 'updated_at']
+
   after_initialize do
     @signatures_checked = false
     @computed_pdh_for_manifest_text = false
@@ -751,4 +753,8 @@ class Collection < ArvadosModel
     self.current_version_uuid ||= self.uuid
     true
   end
+
+  def log_update
+    super unless (saved_changes.keys - UNLOGGED_CHANGES).empty?
+  end
 end
diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index 61bb3f79f..1f2eab73a 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -21,7 +21,7 @@ collection_owned_by_active:
   portable_data_hash: fa7aeb5140e2848d39b416daeef4ffc5+45
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   created_at: 2014-02-03T17:22:54Z
-  modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+  modified_by_client_uuid: zzzzz-ozdt8-teyxzyd8qllg11h
   modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
   modified_at: 2014-02-03T18:22:54Z
   updated_at: 2014-02-03T18:22:54Z
diff --git a/services/api/test/unit/log_test.rb b/services/api/test/unit/log_test.rb
index 76d78f9ea..af95454ae 100644
--- a/services/api/test/unit/log_test.rb
+++ b/services/api/test/unit/log_test.rb
@@ -228,6 +228,20 @@ class LogTest < ActiveSupport::TestCase
     assert_logged(auth, :update)
   end
 
+  test "don't log changes only to Collection.preserve_version" do
+    set_user_from_auth :active
+    col = collections(:collection_owned_by_active)
+    start_log_count = get_logs_about(col).size
+    assert_equal false, col.preserve_version
+    col.preserve_version = true
+    col.save!
+    assert_equal(start_log_count, get_logs_about(col).size,
+                 "log count changed after updating Collection.preserve_version")
+    col.name = 'updated by admin'
+    col.save!
+    assert_logged(col, :update)
+  end
+
   test "token isn't included in ApiClientAuthorization logs" do
     set_user_from_auth :admin_trustedclient
     auth = ApiClientAuthorization.new

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list