search_index.rb 686 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. class User
  3. module SearchIndex
  4. extend ActiveSupport::Concern
  5. def search_index_attribute_lookup(include_references: true)
  6. attributes = super
  7. attributes['fullname'] = fullname
  8. attributes.delete('password')
  9. if include_references
  10. attributes['permissions'] = []
  11. permissions_with_child_ids.each do |permission_id|
  12. permission = ::Permission.lookup(id: permission_id)
  13. next if !permission
  14. attributes['permissions'].push permission.name
  15. end
  16. attributes['role_ids'] = role_ids
  17. end
  18. attributes
  19. end
  20. end
  21. end