assets.rb 865 B

12345678910111213141516171819202122232425262728293031
  1. # Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. class Report::Profile
  3. module Assets
  4. extend ActiveSupport::Concern
  5. def assets(data)
  6. app_model_report_profile = Report::Profile.to_app_model
  7. data[ app_model_report_profile ] ||= {}
  8. return data if data[ app_model_report_profile ][ id ]
  9. data[ app_model_report_profile ][ id ] = attributes_with_association_ids
  10. data = assets_of_selector('condition', data)
  11. app_model_user = User.to_app_model
  12. data[ app_model_user ] ||= {}
  13. %w[created_by_id updated_by_id].each do |local_user_id|
  14. next if !self[ local_user_id ]
  15. next if data[ app_model_user ][ self[ local_user_id ] ]
  16. user = User.lookup(id: self[ local_user_id ])
  17. next if !user
  18. data = user.assets(data)
  19. end
  20. data
  21. end
  22. end
  23. end