2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
2013-06-12 15:59:58 +00:00
|
|
|
|
2012-10-18 08:10:12 +00:00
|
|
|
module ExtraCollection
|
2020-10-05 14:26:25 +00:00
|
|
|
|
|
|
|
module_function
|
|
|
|
|
2014-08-02 21:54:54 +00:00
|
|
|
def session( collections, assets, user )
|
2012-10-18 08:10:12 +00:00
|
|
|
|
|
|
|
# all base stuff
|
2016-03-31 13:41:34 +00:00
|
|
|
collections[ Locale.to_app_model ] = Locale.where(active: true)
|
2015-04-27 06:20:52 +00:00
|
|
|
|
2016-03-31 13:41:34 +00:00
|
|
|
collections[ Taskbar.to_app_model ] = Taskbar.where(user_id: user.id)
|
2017-10-01 12:25:52 +00:00
|
|
|
collections[ Taskbar.to_app_model ].each do |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2012-10-18 08:10:12 +00:00
|
|
|
|
2018-03-20 12:16:17 +00:00
|
|
|
collections[ OnlineNotification.to_app_model ] = []
|
|
|
|
OnlineNotification.list(user, 200).each do |item|
|
|
|
|
assets = item.assets(assets)
|
|
|
|
end
|
2014-08-26 07:40:25 +00:00
|
|
|
|
2018-03-20 12:16:17 +00:00
|
|
|
collections[ RecentView.to_app_model ] = []
|
|
|
|
RecentView.list(user, 10).each do |item|
|
|
|
|
assets = item.assets(assets)
|
|
|
|
end
|
2014-08-26 14:30:16 +00:00
|
|
|
|
2016-08-12 16:39:09 +00:00
|
|
|
collections[ Permission.to_app_model ] = []
|
2017-10-01 12:25:52 +00:00
|
|
|
Permission.all.each do |item|
|
2016-08-12 16:39:09 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2016-08-12 16:39:09 +00:00
|
|
|
|
2014-08-13 00:12:38 +00:00
|
|
|
collections[ Role.to_app_model ] = []
|
2017-10-01 12:25:52 +00:00
|
|
|
Role.all.each do |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2014-08-02 21:54:54 +00:00
|
|
|
|
2014-08-13 00:12:38 +00:00
|
|
|
collections[ Group.to_app_model ] = []
|
2017-10-01 12:25:52 +00:00
|
|
|
Group.all.each do |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2015-09-23 15:22:31 +00:00
|
|
|
|
|
|
|
collections[ Organization.to_app_model ] = []
|
|
|
|
if user.organization_id
|
2017-10-01 12:25:52 +00:00
|
|
|
Organization.where(id: user.organization_id).each do |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2012-11-12 09:34:22 +00:00
|
|
|
end
|
2015-09-23 15:22:31 +00:00
|
|
|
|
2014-08-26 07:40:25 +00:00
|
|
|
[collections, assets]
|
2012-10-18 08:10:12 +00:00
|
|
|
end
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|