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
This commit is contained in:
Jean-Philippe Lang
2009-12-19 14:08:48 +00:00
parent 9d120c872c
commit 06ca18b042
4 changed files with 52 additions and 8 deletions
+9 -3
View File
@@ -20,6 +20,8 @@
# ignore: email is ignored (default)
# accept: accept as anonymous user
# create: create a user account
# --no-permission-check disable permission checking when receiving
# the email
# -h, --help show this help
# -v, --verbose show extra information
# -V, --version show version information and exit
@@ -69,7 +71,7 @@ end
class RedmineMailHandler
VERSION = '0.1'
attr_accessor :verbose, :issue_attributes, :allow_override, :unknown_user, :url, :key
attr_accessor :verbose, :issue_attributes, :allow_override, :unknown_user, :no_permission_check, :url, :key
def initialize
self.issue_attributes = {}
@@ -86,7 +88,8 @@ class RedmineMailHandler
[ '--category', GetoptLong::REQUIRED_ARGUMENT],
[ '--priority', GetoptLong::REQUIRED_ARGUMENT],
[ '--allow-override', '-o', GetoptLong::REQUIRED_ARGUMENT],
[ '--unknown-user', GetoptLong::REQUIRED_ARGUMENT]
[ '--unknown-user', GetoptLong::REQUIRED_ARGUMENT],
[ '--no-permission-check', GetoptLong::NO_ARGUMENT]
)
opts.each do |opt, arg|
@@ -107,6 +110,8 @@ class RedmineMailHandler
self.allow_override = arg.dup
when '--unknown-user'
self.unknown_user = arg.dup
when '--no-permission-check'
self.no_permission_check = '1'
end
end
@@ -118,7 +123,8 @@ class RedmineMailHandler
data = { 'key' => key, 'email' => email,
'allow_override' => allow_override,
'unknown_user' => unknown_user }
'unknown_user' => unknown_user,
'no_permission_check' => no_permission_check}
issue_attributes.each { |attr, value| data["issue[#{attr}]"] = value }
debug "Posting to #{uri}..."