summaryrefslogtreecommitdiffstats
path: root/test/unit/mail_handler_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-19 14:08:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-19 14:08:48 +0000
commit06ca18b04225a68769ab742900ec74ce776c2e86 (patch)
tree72db2b3b95bd049da95e0f257ec77514d835f099 /test/unit/mail_handler_test.rb
parent9d120c872c1b5849d987e3950f2cf914e1e34fe2 (diff)
downloadredmine-06ca18b04225a68769ab742900ec74ce776c2e86.tar.gz
redmine-06ca18b04225a68769ab742900ec74ce776c2e86.zip
Adds a 'no_permission_check' option to the MailHandler.
Used with the 'project' option, it allows anyone to submit emails to a private inbox project (#4407). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3195 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/mail_handler_test.rb')
-rw-r--r--test/unit/mail_handler_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index 79cddd93c..a4ae37345 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -165,6 +165,26 @@ class MailHandlerTest < ActiveSupport::TestCase
end
end
+ def test_add_issue_by_anonymous_user_on_private_project
+ Role.anonymous.add_permission!(:add_issues)
+ assert_no_difference 'User.count' do
+ assert_no_difference 'Issue.count' do
+ assert_equal false, submit_email('ticket_by_unknown_user.eml', :issue => {:project => 'onlinestore'}, :unknown_user => 'accept')
+ end
+ end
+ end
+
+ def test_add_issue_by_anonymous_user_on_private_project_without_permission_check
+ assert_no_difference 'User.count' do
+ assert_difference 'Issue.count' do
+ issue = submit_email('ticket_by_unknown_user.eml', :issue => {:project => 'onlinestore'}, :no_permission_check => '1', :unknown_user => 'accept')
+ assert issue.is_a?(Issue)
+ assert issue.author.anonymous?
+ assert !issue.project.is_public?
+ end
+ end
+ end
+
def test_add_issue_by_created_user
Setting.default_language = 'en'
assert_difference 'User.count' do
ate-workflows/default Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/apps/files/index.php
blob: c9eea6a41747ceb2fd08ff36db487935d20fbb5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157