Class: Decidim::Verifications::RevokeAuthorizationsByConditionJob
- Inherits:
-
ApplicationJob
- Object
- ApplicationJob
- Decidim::Verifications::RevokeAuthorizationsByConditionJob
- Defined in:
- app/jobs/decidim/verifications/revoke_authorizations_by_condition_job.rb
Instance Method Summary collapse
-
#perform(organization, current_user, before_date, impersonated_only) ⇒ Object
Revokes the organization’s granted authorizations created before the given date, optionally limited to impersonated users only.
Instance Method Details
#perform(organization, current_user, before_date, impersonated_only) ⇒ Object
Revokes the organization’s granted authorizations created before the given date, optionally limited to impersonated users only.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/jobs/decidim/verifications/revoke_authorizations_by_condition_job.rb', line 15 def perform(organization, current_user, before_date, impersonated_only) = if impersonated_only Decidim::Verifications::AuthorizationsBeforeDate.new( organization:, date: before_date, granted: true, impersonated_only: ) else Decidim::Verifications::AuthorizationsBeforeDate.new( organization:, date: before_date, granted: true ) end auths = .query.includes(transfers: :records) auths.find_each do |auth| Decidim.traceability.perform_action!( :destroy, auth, current_user ) do auth.destroy end end end |