Commit 0fcf86d44896774ec82af0ea41ac6c61a95a3485
1 parent
e63fb6cd
Exists in
master
and in
22 other branches
Remove Rails 2.1 handling code from noosfero HTTP caching code
Showing
1 changed file
with
0 additions
and
34 deletions
Show diff stats
vendor/plugins/noosfero_caching/init.rb
| @@ -2,8 +2,6 @@ module NoosferoHttpCaching | @@ -2,8 +2,6 @@ module NoosferoHttpCaching | ||
| 2 | 2 | ||
| 3 | def self.included(c) | 3 | def self.included(c) |
| 4 | c.send(:after_filter, :noosfero_set_cache) | 4 | c.send(:after_filter, :noosfero_set_cache) |
| 5 | - c.send(:before_filter, :noosfero_session_check_before) | ||
| 6 | - c.send(:after_filter, :noosfero_session_check_after) | ||
| 7 | end | 5 | end |
| 8 | 6 | ||
| 9 | def noosfero_set_cache | 7 | def noosfero_set_cache |
| @@ -27,38 +25,6 @@ module NoosferoHttpCaching | @@ -27,38 +25,6 @@ module NoosferoHttpCaching | ||
| 27 | end | 25 | end |
| 28 | end | 26 | end |
| 29 | 27 | ||
| 30 | - def noosfero_session_check_before | ||
| 31 | - return if params[:controller] == 'account' | ||
| 32 | - headers["X-Noosfero-Auth"] = (session[:user] != nil).to_s | ||
| 33 | - end | ||
| 34 | - | ||
| 35 | - def noosfero_session_check_after | ||
| 36 | - if headers['X-Noosfero-Auth'] == 'true' | ||
| 37 | - # special case: logout | ||
| 38 | - if !session[:user] | ||
| 39 | - session.delete | ||
| 40 | - end | ||
| 41 | - else | ||
| 42 | - # special case: login | ||
| 43 | - if session[:user] | ||
| 44 | - headers['X-Noosfero-Auth'] = 'true' | ||
| 45 | - end | ||
| 46 | - end | ||
| 47 | - end | ||
| 48 | - | ||
| 49 | -end | ||
| 50 | - | ||
| 51 | -class ActionController::CgiResponse | ||
| 52 | - | ||
| 53 | - def out_with_noosfero_session_check(output = $stdout) | ||
| 54 | - if headers['X-Noosfero-Auth'] == 'false' | ||
| 55 | - @cgi.send(:instance_variable_set, '@output_cookies', nil) | ||
| 56 | - end | ||
| 57 | - headers.delete('X-Noosfero-Auth') | ||
| 58 | - out_without_noosfero_session_check(output) | ||
| 59 | - end | ||
| 60 | - alias_method_chain :out, :noosfero_session_check | ||
| 61 | - | ||
| 62 | end | 28 | end |
| 63 | 29 | ||
| 64 | if Rails.env != 'development' | 30 | if Rails.env != 'development' |