collection_base.rb 978 B

12345678910111213141516171819202122232425262728293031323334
  1. # Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
  2. module ExtraCollection
  3. def session( collections, user )
  4. # all base stuff
  5. collections['Taskbar'] = Taskbar.where( :user_id => user.id )
  6. collections['Role'] = Role.all
  7. collections['Group'] = Group.all
  8. if !user.is_role('Customer')
  9. collections['Organization'] = Organization.all
  10. else
  11. if user.organization_id
  12. collections['Organization'] = Organization.where( :id => user.organization_id )
  13. end
  14. end
  15. end
  16. def push( collections, user )
  17. # all base stuff
  18. collections['Role'] = Role.all
  19. collections['Group'] = Group.all
  20. if !user.is_role('Customer')
  21. collections['Organization'] = Organization.all
  22. else
  23. if user.organization_id
  24. collections['Organization'] = Organization.where( :id => user.organization_id )
  25. end
  26. end
  27. end
  28. module_function :session, :push
  29. end