search.rb 811 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Chat::Session
  3. module Search
  4. extend ActiveSupport::Concern
  5. include CanSearch
  6. # methods defined here are going to extend the class, not the instance of it
  7. class_methods do
  8. =begin
  9. search organizations preferences
  10. result = Chat::Session.search_preferences(user_model)
  11. returns if user has permissions to search
  12. result = {
  13. prio: 1000,
  14. direct_search_index: true
  15. }
  16. returns if user has no permissions to search
  17. result = false
  18. =end
  19. def search_preferences(current_user)
  20. return false if Setting.get('chat') != true || !current_user.permissions?('chat.agent')
  21. {
  22. prio: 900,
  23. direct_search_index: true,
  24. }
  25. end
  26. end
  27. end
  28. end