Sha256: 41e16281a6fa222a4c3971fa6368892735d596bcde6c13d13c67b819329d3334

Contents?: true

Size: 621 Bytes

Versions: 9

Compression:

Stored size: 621 Bytes

Contents

description 'Forbid anonymous access, redirect to login'

class ::Olelo::Application
  PUBLIC_ACCESS = %w(/login)

  redefine_method :include_page do |path|
    User.logged_in? ? super(path) : ''
  end

  hook :menu, 999 do |menu|
    menu.clear if menu.name == :actions && !User.logged_in?
  end

  before :routing do
    if !User.logged_in?
      if !PUBLIC_ACCESS.include?(request.path_info)
        flash.error :login_first.t
        session[:olelo_goto] = request.path_info if request.get? && request.path_info !~ %r{^/_/}
        redirect build_path(:login)
      end
      @disable_assets = true
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
olelo-0.9.8 plugins/security/private_wiki.rb
olelo-0.9.7 plugins/security/private_wiki.rb
olelo-0.9.6 plugins/security/private_wiki.rb
olelo-0.9.5 plugins/security/private_wiki.rb
olelo-0.9.4 plugins/security/private_wiki.rb
olelo-0.9.3 plugins/security/private_wiki.rb
olelo-0.9.2 plugins/security/private_wiki.rb
olelo-0.9.1 plugins/security/private_wiki.rb
olelo-0.9.0 plugins/security/private_wiki.rb