chore(encryption): task rotating api particulier token encrypted attributes
This commit is contained in:
parent
3ac671576b
commit
ca7100c7af
2 changed files with 72 additions and 0 deletions
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
class RotateAPIParticulierTokenEncryptionTask < MaintenanceTasks::Task
|
||||
def collection
|
||||
# rubocop:disable DS/Unscoped
|
||||
Procedure.unscoped.where.not(encrypted_api_particulier_token: nil)
|
||||
# rubocop:enable DS/Unscoped
|
||||
end
|
||||
|
||||
def process(procedure)
|
||||
decrypted_token = procedure.api_particulier_token
|
||||
|
||||
procedure.api_particulier_token = decrypted_token
|
||||
procedure.save!(validate: false)
|
||||
end
|
||||
|
||||
def count
|
||||
collection.count
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue