Class: Netzke::Basepack::AuthApp
- Defined in:
- lib/netzke/basepack/auth_app.rb
Overview
Extension to SimpleApp that brings in support for authentication and masquerading ** NOTE: it’s WIP **
Direct Known Subclasses
Instance Method Summary collapse
- #default_config ⇒ Object
-
#initialize(*args) ⇒ AuthApp
constructor
A new instance of AuthApp.
-
#menu ⇒ Object
Set the Logout button if Netzke::Core.current_user is set.
- #user_menu ⇒ Object
Methods inherited from SimpleApp
#configuration, #js_component_html, #js_component_render, #main_panel_config, #menu_bar_config, #status_bar_config
Constructor Details
#initialize(*args) ⇒ AuthApp
Returns a new instance of AuthApp.
119 120 121 122 123 124 125 126 127 128 |
# File 'lib/netzke/basepack/auth_app.rb', line 119 def initialize(*args) super if session[:netzke_just_logged_in] || session[:netzke_just_logged_out] session[:config_mode] = false session[:masq_world] = session[:masq_user] = session[:masq_roles] = nil end strong_children_config.deep_merge!(:mode => :config) if session[:config_mode] end |
Instance Method Details
#default_config ⇒ Object
7 8 9 10 11 12 |
# File 'lib/netzke/basepack/auth_app.rb', line 7 def default_config super.tap do |c| c[:login_url] = "/login" c[:logout_url] = "/logout" end end |
#menu ⇒ Object
Set the Logout button if Netzke::Core.current_user is set
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/netzke/basepack/auth_app.rb', line 99 def [].tap do || user = Netzke::Core.current_user if !user.nil? user_name = user.respond_to?(:name) ? user.name : user.email # try to display user's name, fallback to email << "->" << { :text => user_name, :menu => } else << "->" << :login.action end end end |
#user_menu ⇒ Object
115 116 117 |
# File 'lib/netzke/basepack/auth_app.rb', line 115 def [:logout.action] end |