Adds 'Delete wiki pages attachments' permission.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1938 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
64e67f754d
commit
ccbe48d779
|
@ -0,0 +1,13 @@
|
||||||
|
class AddDeleteWikiPagesAttachmentsPermission < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
Role.find(:all).each do |r|
|
||||||
|
r.add_permission!(:delete_wiki_pages_attachments) if r.has_permission?(:edit_wiki_pages)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
Role.find(:all).each do |r|
|
||||||
|
r.remove_permission!(:delete_wiki_pages_attachments)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -81,7 +81,8 @@ Redmine::AccessControl.map do |map|
|
||||||
map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member
|
map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member
|
||||||
map.permission :view_wiki_pages, :wiki => [:index, :special]
|
map.permission :view_wiki_pages, :wiki => [:index, :special]
|
||||||
map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate]
|
map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate]
|
||||||
map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment, :destroy_attachment]
|
map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment]
|
||||||
|
map.permission :delete_wiki_pages_attachments, :wiki => :destroy_attachment
|
||||||
map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member
|
map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ roles_001:
|
||||||
- :view_wiki_pages
|
- :view_wiki_pages
|
||||||
- :view_wiki_edits
|
- :view_wiki_edits
|
||||||
- :edit_wiki_pages
|
- :edit_wiki_pages
|
||||||
|
- :delete_wiki_pages_attachments
|
||||||
- :protect_wiki_pages
|
- :protect_wiki_pages
|
||||||
- :delete_wiki_pages
|
- :delete_wiki_pages
|
||||||
- :rename_wiki_pages
|
- :rename_wiki_pages
|
||||||
|
|
|
@ -251,4 +251,11 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'edit'
|
assert_template 'edit'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_destroy_attachment
|
||||||
|
@request.session[:user_id] = 2
|
||||||
|
assert_difference 'Attachment.count', -1 do
|
||||||
|
post :destroy_attachment, :id => 1, :page => 'Page_with_an_inline_image', :attachment_id => 3
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue