summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/wiki_controller.rb28
-rw-r--r--app/views/wiki/show.rhtml2
-rw-r--r--app/views/wiki/special_date_index.rhtml2
-rw-r--r--app/views/wiki/special_page_index.rhtml2
4 files changed, 20 insertions, 14 deletions
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 782f939d6..97e1531c0 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -47,15 +47,17 @@ class WikiController < ApplicationController
return
end
@content = @page.content_for_version(params[:version])
- if params[:format] == 'html'
- export = render_to_string :action => 'export', :layout => false
- send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
- return
- elsif params[:format] == 'txt'
- send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt")
- return
+ if User.current.allowed_to?(:export_wiki_pages, @project)
+ if params[:format] == 'html'
+ export = render_to_string :action => 'export', :layout => false
+ send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
+ return
+ elsif params[:format] == 'txt'
+ send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt")
+ return
+ end
end
- @editable = editable?
+ @editable = editable?
render :action => 'show'
end
@@ -177,9 +179,13 @@ class WikiController < ApplicationController
@pages_by_parent_id = @pages.group_by(&:parent_id)
# export wiki to a single html file
when 'export'
- @pages = @wiki.pages.find :all, :order => 'title'
- export = render_to_string :action => 'export_multiple', :layout => false
- send_data(export, :type => 'text/html', :filename => "wiki.html")
+ if User.current.allowed_to?(:export_wiki_pages, @project)
+ @pages = @wiki.pages.find :all, :order => 'title'
+ export = render_to_string :action => 'export_multiple', :layout => false
+ send_data(export, :type => 'text/html', :filename => "wiki.html")
+ else
+ redirect_to :action => 'index', :id => @project, :page => nil
+ end
return
else
# requested special page doesn't exist, redirect to default page
diff --git a/app/views/wiki/show.rhtml b/app/views/wiki/show.rhtml
index 0ae8c10dc..690e9102b 100644
--- a/app/views/wiki/show.rhtml
+++ b/app/views/wiki/show.rhtml
@@ -48,7 +48,7 @@
<% other_formats_links do |f| %>
<%= f.link_to 'HTML', :url => {:page => @page.title, :version => @content.version} %>
<%= f.link_to 'TXT', :url => {:page => @page.title, :version => @content.version} %>
-<% end %>
+<% end if User.current.allowed_to?(:export_wiki_pages, @project) %>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
diff --git a/app/views/wiki/special_date_index.rhtml b/app/views/wiki/special_date_index.rhtml
index 53b7124c1..228737a5e 100644
--- a/app/views/wiki/special_date_index.rhtml
+++ b/app/views/wiki/special_date_index.rhtml
@@ -24,7 +24,7 @@
<% unless @pages.empty? %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %>
- <%= f.link_to 'HTML', :url => {:action => 'special', :page => 'export'} %>
+ <%= f.link_to('HTML', :url => {:action => 'special', :page => 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %>
<% end %>
<% end %>
diff --git a/app/views/wiki/special_page_index.rhtml b/app/views/wiki/special_page_index.rhtml
index 0b8eeccce..b3ad10019 100644
--- a/app/views/wiki/special_page_index.rhtml
+++ b/app/views/wiki/special_page_index.rhtml
@@ -17,7 +17,7 @@
<% unless @pages.empty? %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %>
- <%= f.link_to 'HTML', :url => {:action => 'special', :page => 'export'} %>
+ <%= f.link_to('HTML', :url => {:action => 'special', :page => 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %>
<% end %>
<% end %>