module Fiona7 module CurrentUserMapHelper def self.groups_for_user(user) user_name = user.id rescue "" return [] if user_name.blank? Reactor::Sudo.su(Fiona7.root) do Reactor::Cache::User.instance.get(user_name).groups end rescue => e Rails.logger.error "Error occured while reading user groups of #{user_name} (#{e.message})" [] end end module CurrentUserMap protected def current_user @current_user ||= OpenStruct.new({ :live_server_groups => CurrentUserMapHelper.groups_for_user(scrivito_user) }) end end end