Sha256: 083bc7cd6b8229eeb35b66499e09854e57aacc550c58d73c9cab7982460af769

Contents?: true

Size: 790 Bytes

Versions: 1

Compression:

Stored size: 790 Bytes

Contents

##
# Module loads data from external sources for {Anubis::Sso::Client::DataController}
module Anubis::Sso::Client::Data::Load
  include Anubis::Core::Data::Load

  def load_menu_data
    menu_json = self.redis.get(self.redis_prefix + 'menu:' + params[:controller])

    unless menu_json
      menu = Anubis::Sso::Client::Menu.where(mode: params[:controller], status: 'enabled').first
      self.redis.set(self.redis_prefix + 'menu:'+ params[:controller], menu.to_json) if menu
    else
      menu = Anubis::Sso::Client::Menu.new(JSON.parse(menu_json,  { :symbolize_names => true }))
    end

    if menu
      self.etc.menu = Anubis::Etc::Menu.new menu

      if self.writer
        self.etc.menu.access = 'write'
      else
        self.etc.menu.access = 'read'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
anoubis-1.0.0 app/controllers/anoubis/sso/client/data/load.rb