diff --git a/CHANGELOG b/CHANGELOG index 8a4e411a..56225b6b 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,9 @@ "textile link":LinkToSomePlace will not look insane. RSS feeds accept query parameters, sush as http://localhost:2500/wiki/rss_with_headlines?start=2005-02-18&end=2005-02-19&limit=10 + RSS feed wiuth page contents for a password-protected web behaves as follows: + if the web is published, RSS feed links to the published version of the web + otherwise, the feed is not available Madeleine will check every hour if there are new commands in the log or 24 hours have passed since last snapshot, and take snapshot if either of these conditions is true Madeleine will also not log read-only operations, resulting in a better performance diff --git a/app/controllers/application.rb b/app/controllers/application.rb index abf82902..f56a185d 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -28,10 +28,8 @@ class ApplicationController < ActionController::Base end def check_authorization - if in_a_web? and - not authorized? and - not %w( login authenticate published ).include?(@action_name) - redirect_to :action => 'login', :web => @web_name + if in_a_web? and needs_authorization?(@action_name) and not authorized? and + redirect_to :controller => 'wiki', :action => 'login', :web => @web_name return false end end @@ -126,4 +124,8 @@ class ApplicationController < ActionController::Base $instiki_wiki_service end + def needs_authorization?(action) + not %w( login authenticate published rss_with_content rss_with_headlines ).include?(action) + end + end diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index c084c030..06448c2a 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -75,6 +75,7 @@ class WikiController < ApplicationController end def feeds + @rss_with_content_allowed = rss_with_content_allowed? # show the template end @@ -91,7 +92,12 @@ class WikiController < ApplicationController end def rss_with_content - render_rss(hide_description = false, *parse_rss_params) + if rss_with_content_allowed? + render_rss(hide_description = false, *parse_rss_params) + else + render_text 'RSS feed with content for this web is blocked for security reasons. ' + + 'The web is password-protected and not published', '403 Forbidden' + end end def rss_with_headlines @@ -326,6 +332,8 @@ class WikiController < ApplicationController @hide_description = hide_description @response.headers['Content-Type'] = 'text/xml' + @link_action = @web.password ? 'published' : 'show' + render 'wiki/rss_feed' end @@ -343,6 +351,10 @@ class WikiController < ApplicationController @template.render_file(template_name) end + def rss_with_content_allowed? + @web.password.nil? or @web.published + end + def truncate(text, length = 30, truncate_string = '...') if text.length > length then text[0..(length - 3)] + truncate_string else text end end diff --git a/app/views/wiki/feeds.rhtml b/app/views/wiki/feeds.rhtml index 46b79b69..389d6983 100644 --- a/app/views/wiki/feeds.rhtml +++ b/app/views/wiki/feeds.rhtml @@ -4,7 +4,7 @@