Sha256: 53faa76ce9c381205a4eca3776cb91585c2aa78b59b1f5f02285873b117df590

Contents?: true

Size: 1.33 KB

Versions: 9

Compression:

Stored size: 1.33 KB

Contents

require "wobauth/engine"

module Wobauth

  def self.setup
    yield self
  end

  # authorizable types
  #
  mattr_reader :authorizable_types, :authorizable_group_method
  @@authorizable_types = [ "Wobauth::User", "Wobauth::Group" ]
  @@authorizable_group_method = :all
  
  # authorized_for types
  # Objects on which Wobauth should set authorization
  #
  mattr_accessor :authorized_for_types, :authorized_for_group_method
  @@authorized_for_types = [ ]
  @@authorized_for_group_method = :all

  # is remote authentication possible using REMOTE_USER?
  # default: check devise settings
  mattr_writer :remote_authentication
  @@remote_authentication = nil

  def self.remote_authentication?
    if @@remote_authentication.nil?
      @@remote_authentication = User.devise_modules.include?(:remote_user_authenticatable)
    end
    @@remote_authentication
  end

  # config file for ldap settings
  #
  mattr_writer :ldap_config
  @@ldap_config = nil


  def self.ldap_options
    return {} if @@ldap_config.blank?
    if File.readable? @@ldap_config
      config = YAML.load_file(@@ldap_config)
    end
    config ||= Hash.new

    if config['ldap_options'].present?
      opts = config['ldap_options'].symbolize_keys
      opts.each do |k,v|
        opts[k] = opts[k].symbolize_keys if opts[k].kind_of? Hash
      end
    else
      nil
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
wobauth-5.0.2 lib/wobauth.rb
wobauth-5.0.1 lib/wobauth.rb
wobauth-5.0.0 lib/wobauth.rb
wobauth-4.0.0 lib/wobauth.rb
wobauth-3.4.8 lib/wobauth.rb
wobauth-3.4.7 lib/wobauth.rb
wobauth-3.4.6 lib/wobauth.rb
wobauth-3.4.5 lib/wobauth.rb
wobauth-3.4.4 lib/wobauth.rb