summaryrefslogtreecommitdiffstats
path: root/app/controllers/wiki_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-06 09:30:53 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-06 09:30:53 +0000
commit6c8b87fbc8a52b53a0adb53f072508ade7e2dca6 (patch)
treeb64eefe5f3f112ed9f5867cb87af22b56f1bd919 /app/controllers/wiki_controller.rb
parente5d300af0a4d6703b043c05d4178353e7e252bf2 (diff)
downloadredmine-6c8b87fbc8a52b53a0adb53f072508ade7e2dca6.tar.gz
redmine-6c8b87fbc8a52b53a0adb53f072508ade7e2dca6.zip
Adds a permission for exporting wiki pages.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3371 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/wiki_controller.rb')
-rw-r--r--app/controllers/wiki_controller.rb28
1 files changed, 17 insertions, 11 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