Sha256: 03b34e879aa500d52fc50a665ccebe2f7700d459d5c26c2f21ab93b2a2f29257

Contents?: true

Size: 608 Bytes

Versions: 43

Compression:

Stored size: 608 Bytes

Contents

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

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
infopark_fiona7-0.71.1.12 lib/fiona7/current_user_map.rb
infopark_fiona7-0.71.1.11 lib/fiona7/current_user_map.rb
infopark_fiona7-0.71.1.10 lib/fiona7/current_user_map.rb