Adds permissions to let users edit and/or delete their messages (#854, patch by Markus Knittig with slight changes).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2019 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Vendored
+13
-2
@@ -38,8 +38,8 @@ messages_004:
|
||||
updated_on: 2007-08-12 17:15:32 +02:00
|
||||
subject: Post 2
|
||||
id: 4
|
||||
replies_count: 1
|
||||
last_reply_id: 5
|
||||
replies_count: 2
|
||||
last_reply_id: 6
|
||||
content: "This is an other post"
|
||||
author_id:
|
||||
parent_id:
|
||||
@@ -55,3 +55,14 @@ messages_005:
|
||||
author_id: 1
|
||||
parent_id: 4
|
||||
board_id: 1
|
||||
messages_006:
|
||||
created_on: <%= 2.days.ago.to_date.to_s(:db) %>
|
||||
updated_on: <%= 2.days.ago.to_date.to_s(:db) %>
|
||||
subject: 'RE: post 2'
|
||||
id: 6
|
||||
replies_count: 0
|
||||
last_reply_id:
|
||||
content: "Another reply to the second post"
|
||||
author_id: 3
|
||||
parent_id: 4
|
||||
board_id: 1
|
||||
|
||||
Vendored
+2
@@ -80,6 +80,8 @@ roles_002:
|
||||
- :protect_wiki_pages
|
||||
- :delete_wiki_pages
|
||||
- :add_messages
|
||||
- :edit_own_messages
|
||||
- :delete_own_messages
|
||||
- :manage_boards
|
||||
- :view_files
|
||||
- :manage_files
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
|
||||
class MessageTest < Test::Unit::TestCase
|
||||
fixtures :projects, :boards, :messages, :users, :watchers
|
||||
fixtures :projects, :roles, :members, :boards, :messages, :users, :watchers
|
||||
|
||||
def setup
|
||||
@board = Board.find(1)
|
||||
@@ -76,4 +76,22 @@ class MessageTest < Test::Unit::TestCase
|
||||
assert_equal topics_count, board.topics_count
|
||||
assert_equal messages_count - 1, board.messages_count
|
||||
end
|
||||
|
||||
def test_editable_by
|
||||
message = Message.find(6)
|
||||
author = message.author
|
||||
assert message.editable_by?(author)
|
||||
|
||||
author.role_for_project(message.project).remove_permission!(:edit_own_messages)
|
||||
assert !message.reload.editable_by?(author.reload)
|
||||
end
|
||||
|
||||
def test_destroyable_by
|
||||
message = Message.find(6)
|
||||
author = message.author
|
||||
assert message.destroyable_by?(author)
|
||||
|
||||
author.role_for_project(message.project).remove_permission!(:delete_own_messages)
|
||||
assert !message.reload.destroyable_by?(author.reload)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user