[ARVADOS] updated: 1.2.0-29-g59330d17d

Git user git at public.curoverse.com
Thu Sep 6 10:39:24 EDT 2018


Summary of changes:
 services/api/app/models/arvados_model.rb | 45 +++++++++++++++++++++-----------
 1 file changed, 30 insertions(+), 15 deletions(-)

       via  59330d17dc80a1d7dc738569b04d0436329e34f6 (commit)
       via  1416b0952adc0bfee85e15d9c86a51c32fcfd003 (commit)
       via  19f787c5b5833623eee4d6cb88ddb909a5add7fc (commit)
       via  5de415291109d623382b364177f707e4b33e0ee1 (commit)
       via  b78c39a9e242e44357fe7c5f0f70eb534ec2a9e3 (commit)
      from  490f5378e5e902fcf9735fc5520a515c989f350a (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 59330d17dc80a1d7dc738569b04d0436329e34f6
Merge: 490f5378e 1416b0952
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Thu Sep 6 10:37:42 2018 -0400

    Merge branch '11065-optional-audit-logging'
    
    refs #11065
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>


commit 1416b0952adc0bfee85e15d9c86a51c32fcfd003
Merge: 19f787c5b 490f5378e
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Thu Sep 6 10:29:25 2018 -0400

    11065: Merge branch 'master' into 11065-optional-audit-logging
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>


commit 19f787c5b5833623eee4d6cb88ddb909a5add7fc
Author: Colin Nolan <colin-nolan at users.noreply.github.com>
Date:   Mon Jul 30 16:57:59 2018 +0100

    Corrects logic to determine if audit logging is enabled.
    
    Arvados-DCO-1.1-Signed-off-by: Colin Nolan <colin.nolan at sanger.ac.uk>

diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 2edbb935a..4750abf91 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -764,8 +764,8 @@ class ArvadosModel < ActiveRecord::Base
   end
 
   def is_audit_logging_enabled?
-    return Rails.configuration.max_audit_log_age == 0 &&
-           Rails.configuration.max_audit_log_delete_batch > 0
+    return !(Rails.configuration.max_audit_log_age.to_i == 0 &&
+             Rails.configuration.max_audit_log_delete_batch.to_i > 0)
   end
 
   def log_start_state

commit 5de415291109d623382b364177f707e4b33e0ee1
Author: Joshua C. Randall <jcrandall at alum.mit.edu>
Date:   Fri Jul 13 16:20:18 2018 +0000

    fix ruby syntax of audit logging disabled check
    
    `max_audit_log_delete_batch > 0 && max_audit_log_age == 0`
    
    Arvados-DCO-1.1-Signed-off-by: Joshua C. Randall <jcrandall at alum.mit.edu>

diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 19f08e729..2edbb935a 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -764,8 +764,8 @@ class ArvadosModel < ActiveRecord::Base
   end
 
   def is_audit_logging_enabled?
-    return Rails.configuration.max_audit_log_age == 0
-             and Rails.configuration.max_audit_log_delete_batch > 0
+    return Rails.configuration.max_audit_log_age == 0 &&
+           Rails.configuration.max_audit_log_delete_batch > 0
   end
 
   def log_start_state

commit b78c39a9e242e44357fe7c5f0f70eb534ec2a9e3
Author: Colin Nolan <colin.nolan at sanger.ac.uk>
Date:   Tue Aug 7 15:36:56 2018 +0100

    Allow audit logging to be disabled.
    
    Audit logs not written if `max_audit_log_delete_batch > 0 and max_audit_log_age == 0`.
    
    Arvados-DCO-1.1-Signed-off-by: Colin Nolan <colin.nolan at sanger.ac.uk>

diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index b9edeae06..19f08e729 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -763,36 +763,51 @@ class ArvadosModel < ActiveRecord::Base
     end
   end
 
+  def is_audit_logging_enabled?
+    return Rails.configuration.max_audit_log_age == 0
+             and Rails.configuration.max_audit_log_delete_batch > 0
+  end
+
   def log_start_state
-    @old_attributes = Marshal.load(Marshal.dump(attributes))
-    @old_logged_attributes = Marshal.load(Marshal.dump(logged_attributes))
+    if is_audit_logging_enabled?
+      @old_attributes = Marshal.load(Marshal.dump(attributes))
+      @old_logged_attributes = Marshal.load(Marshal.dump(logged_attributes))
+    end
   end
 
   def log_change(event_type)
-    log = Log.new(event_type: event_type).fill_object(self)
-    yield log
-    log.save!
-    log_start_state
+    if is_audit_logging_enabled?
+      log = Log.new(event_type: event_type).fill_object(self)
+      yield log
+      log.save!
+      log_start_state
+    end
   end
 
   def log_create
-    log_change('create') do |log|
-      log.fill_properties('old', nil, nil)
-      log.update_to self
+    if is_audit_logging_enabled?
+      log_change('create') do |log|
+        log.fill_properties('old', nil, nil)
+        log.update_to self
+      end
     end
   end
 
   def log_update
-    log_change('update') do |log|
-      log.fill_properties('old', etag(@old_attributes), @old_logged_attributes)
-      log.update_to self
+    if is_audit_logging_enabled?
+      log_change('update') do |log|
+        log.fill_properties('old', etag(@old_attributes), @old_logged_attributes)
+        log.update_to self
+      end
     end
   end
 
   def log_destroy
-    log_change('delete') do |log|
-      log.fill_properties('old', etag(@old_attributes), @old_logged_attributes)
-      log.update_to nil
+    if is_audit_logging_enabled?
+      log_change('delete') do |log|
+        log.fill_properties('old', etag(@old_attributes), @old_logged_attributes)
+        log.update_to nil
+      end
     end
   end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list