2014-02-03 19:24:49 +00:00
|
|
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
2013-06-12 15:59:58 +00:00
|
|
|
|
2012-10-18 08:10:12 +00:00
|
|
|
module ExtraCollection
|
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)
|
2016-06-30 20:04:48 +00:00
|
|
|
collections[ Taskbar.to_app_model ].each { |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
|
|
|
}
|
2012-10-18 08:10:12 +00:00
|
|
|
|
2016-03-31 13:41:34 +00:00
|
|
|
collections[ OnlineNotification.to_app_model ] = OnlineNotification.list(user, 100)
|
2014-08-26 07:40:25 +00:00
|
|
|
assets = ApplicationModel.assets_of_object_list(collections[ OnlineNotification.to_app_model ], assets)
|
|
|
|
|
2014-08-26 14:30:16 +00:00
|
|
|
collections[ RecentView.to_app_model ] = RecentView.list(user, 10)
|
|
|
|
assets = RecentView.assets_of_object_list(collections[ RecentView.to_app_model ], assets)
|
|
|
|
|
2014-08-13 00:12:38 +00:00
|
|
|
collections[ Role.to_app_model ] = []
|
2016-06-30 20:04:48 +00:00
|
|
|
Role.all.each { |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
|
|
|
}
|
|
|
|
|
2014-08-13 00:12:38 +00:00
|
|
|
collections[ Group.to_app_model ] = []
|
2016-06-30 20:04:48 +00:00
|
|
|
Group.all.each { |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
|
|
|
}
|
2015-09-23 15:22:31 +00:00
|
|
|
|
|
|
|
collections[ Organization.to_app_model ] = []
|
|
|
|
if user.organization_id
|
2016-06-30 20:04:48 +00:00
|
|
|
Organization.where(id: user.organization_id).each { |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
|
|
|
}
|
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
|
2014-08-02 21:54:54 +00:00
|
|
|
module_function :session
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|