trabajo-afectivo/app/controllers/sessions/collection_base.rb

46 lines
1.3 KiB
Ruby
Raw Normal View History

2014-02-03 19:24:49 +00:00
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
2012-10-18 08:10:12 +00:00
module ExtraCollection
def session( collections, assets, user )
2012-10-18 08:10:12 +00:00
# all base stuff
collections[ Locale.to_app_model ] = Locale.where(active: true)
2015-04-27 06:20:52 +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|
assets = item.assets(assets)
}
2012-10-18 08:10:12 +00:00
collections[ OnlineNotification.to_app_model ] = OnlineNotification.list(user, 100)
assets = ApplicationModel.assets_of_object_list(collections[ OnlineNotification.to_app_model ], assets)
collections[ RecentView.to_app_model ] = RecentView.list(user, 10)
assets = RecentView.assets_of_object_list(collections[ RecentView.to_app_model ], assets)
collections[ Permission.to_app_model ] = []
Permission.all.each { |item|
assets = item.assets(assets)
}
collections[ Role.to_app_model ] = []
2016-06-30 20:04:48 +00:00
Role.all.each { |item|
assets = item.assets(assets)
}
collections[ Group.to_app_model ] = []
2016-06-30 20:04:48 +00:00
Group.all.each { |item|
assets = item.assets(assets)
}
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|
assets = item.assets(assets)
}
2012-11-12 09:34:22 +00:00
end
[collections, assets]
2012-10-18 08:10:12 +00:00
end
module_function :session
end