Support filters=[["attr","=",nil]]
[arvados.git] / services / api / app / models / api_client_authorization.rb
index 38a90d5c136aade3a355e5eb91ea1a02b58b5083..3b73f408c3f03bf35f48a0711357a0487fdeee8e 100644 (file)
@@ -20,8 +20,7 @@ class ApiClientAuthorization < ArvadosModel
     t.add :scopes
   end
 
-  UNLOGGED_ATTRIBUTES = ['last_used_at', 'last_used_by_ip_address',
-                         'updated_at']
+  UNLOGGED_CHANGES = ['last_used_at', 'last_used_by_ip_address', 'updated_at']
 
   def assign_random_api_token
     self.api_token ||= rand(2**256).to_s(36)
@@ -63,6 +62,12 @@ class ApiClientAuthorization < ArvadosModel
   end
   def modified_at=(x) end
 
+  def logged_attributes
+    attrs = attributes.dup
+    attrs.delete('api_token')
+    attrs
+  end
+
   protected
 
   def permission_to_create
@@ -76,6 +81,6 @@ class ApiClientAuthorization < ArvadosModel
   end
 
   def log_update
-    super unless (changed - UNLOGGED_ATTRIBUTES).empty?
+    super unless (changed - UNLOGGED_CHANGES).empty?
   end
 end