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

35 lines
962 B
Ruby
Raw Normal View History

# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
2012-10-18 08:10:12 +00:00
module ExtraCollection
2012-10-23 20:25:42 +00:00
def session( collections, user )
2012-10-18 08:10:12 +00:00
# all base stuff
2013-05-31 23:09:09 +00:00
collections['Taskbar'] = Taskbar.where( :user_id => user.id )
2012-10-18 08:10:12 +00:00
collections['Role'] = Role.all
collections['Group'] = Group.all
2012-11-12 09:34:22 +00:00
if !user.is_role('Customer')
collections['Organization'] = Organization.all
2013-07-19 14:21:44 +00:00
else
if user.organization_id
collections['Organization'] = Organization.find( user.organization_id )
end
2012-11-12 09:34:22 +00:00
end
2012-10-18 08:10:12 +00:00
end
2012-10-23 20:25:42 +00:00
def push( collections, user )
# all base stuff
collections['Role'] = Role.all
collections['Group'] = Group.all
2012-11-12 09:34:22 +00:00
if !user.is_role('Customer')
collections['Organization'] = Organization.all
2013-07-19 14:21:44 +00:00
else
if user.organization_id
collections['Organization'] = Organization.find( user.organization_id )
end
2012-11-12 09:34:22 +00:00
end
end
module_function :session, :push
end