trabajo-afectivo/app/models/user/search_index.rb

27 lines
686 B
Ruby
Raw Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
2016-07-06 06:13:44 +00:00
class User
module SearchIndex
extend ActiveSupport::Concern
2016-07-06 06:13:44 +00:00
def search_index_attribute_lookup(include_references: true)
attributes = super
attributes['fullname'] = fullname
attributes.delete('password')
if include_references
attributes['permissions'] = []
permissions_with_child_ids.each do |permission_id|
permission = ::Permission.lookup(id: permission_id)
next if !permission
2016-07-06 06:13:44 +00:00
attributes['permissions'].push permission.name
2016-07-06 06:13:44 +00:00
end
attributes['role_ids'] = role_ids
2016-07-06 06:13:44 +00:00
end
attributes
end
end
end