15531: Test federation migrate script WIP
[arvados.git] / services / api / app / models / arvados_model.rb
index 91c5a1923c95beaa674dc255835dda50153b5661..f93312693307c39f1c39a85694cfe51011ecdc09 100644 (file)
@@ -409,8 +409,20 @@ class ArvadosModel < ApplicationRecord
     end
   end
 
+  def user_owner_uuid
+    if self.owner_uuid.nil?
+      return current_user.uuid
+    end
+    owner_class = ArvadosModel.resource_class_for_uuid(self.owner_uuid)
+    if owner_class == User
+      self.owner_uuid
+    else
+      owner_class.find_by_uuid(self.owner_uuid).user_owner_uuid
+    end
+  end
+
   def logged_attributes
-    attributes.except(*Rails.configuration.AuditLogs.UnloggedAttributes)
+    attributes.except(*Rails.configuration.AuditLogs.UnloggedAttributes.keys)
   end
 
   def self.full_text_searchable_columns