X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/aebdddd8d1449ff7f8a6ba63054276e798dd79a0..c3b26754a231ec909506f2ff28af1af9f2e27f2b:/services/api/lib/sweep_trashed_objects.rb diff --git a/services/api/lib/sweep_trashed_objects.rb b/services/api/lib/sweep_trashed_objects.rb index 857662ac37..bedbd68a44 100644 --- a/services/api/lib/sweep_trashed_objects.rb +++ b/services/api/lib/sweep_trashed_objects.rb @@ -20,7 +20,7 @@ module SweepTrashedObjects # exceptions, and delete records owned by this project skipped_classes = ['Group', 'User'] ActiveRecord::Base.descendants.reject(&:abstract_class?).each do |klass| - if !skipped_classes.include?(klass.name) && klass.columns.collect{&:name}.include?('owner_uuid') + if !skipped_classes.include?(klass.name) && klass.columns.collect(&:name).include?('owner_uuid') klass.where({owner_uuid: p_uuid}).destroy_all end end @@ -48,6 +48,9 @@ module SweepTrashedObjects where({group_class: 'project'}). where('is_trashed = false and trash_at < statement_timestamp()'). update_all('is_trashed = true') + + # Sweep expired tokens + ActiveRecord::Base.connection.execute("DELETE from api_client_authorizations where expires_at <= statement_timestamp()") end end