summaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-06-14 14:48:34 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-06-14 14:48:34 +0000
commitb3afde14fa6046a022eda73edee85ab48171909f (patch)
tree89dc8da3ab3f51ab9ed88fcc04e216822410aebe /extra
parentc48193f8c113650c14d98b2f96279d57118df973 (diff)
downloadredmine-b3afde14fa6046a022eda73edee85ab48171909f.tar.gz
redmine-b3afde14fa6046a022eda73edee85ab48171909f.zip
Ability to accept incoming emails from unknown users (#2230, #3003).
An option lets you specify how to handle emails from unknown users: * ignore: the email is ignored (previous and default behaviour) * accept: the sender is considered as an anonymous user * create: a user account is created (username/password are sent back to the user) Permissions have to be consistent with the chosen option. Eg. if you choose 'create', the 'Non member' role must have the 'Add issues' permission so that an issue can be created by an unknown user via email. If you choose 'accept', the 'Anonymous' role must have this permission. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2789 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'extra')
-rw-r--r--extra/mail_handler/rdm-mailhandler.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/extra/mail_handler/rdm-mailhandler.rb b/extra/mail_handler/rdm-mailhandler.rb
index 93484ca34..2ee5d73d3 100644
--- a/extra/mail_handler/rdm-mailhandler.rb
+++ b/extra/mail_handler/rdm-mailhandler.rb
@@ -15,6 +15,11 @@
# -k, --key Redmine API key
#
# General options:
+# --unknown-user=ACTION how to handle emails from an unknown user
+# ACTION can be one of the following values:
+# ignore: email is ignored (default)
+# accept: accept as anonymous user
+# create: create a user account
# -h, --help show this help
# -v, --verbose show extra information
# -V, --version show version information and exit
@@ -64,7 +69,7 @@ end
class RedmineMailHandler
VERSION = '0.1'
- attr_accessor :verbose, :issue_attributes, :allow_override, :url, :key
+ attr_accessor :verbose, :issue_attributes, :allow_override, :uknown_user, :url, :key
def initialize
self.issue_attributes = {}
@@ -80,7 +85,8 @@ class RedmineMailHandler
[ '--tracker', '-t', GetoptLong::REQUIRED_ARGUMENT],
[ '--category', GetoptLong::REQUIRED_ARGUMENT],
[ '--priority', GetoptLong::REQUIRED_ARGUMENT],
- [ '--allow-override', '-o', GetoptLong::REQUIRED_ARGUMENT]
+ [ '--allow-override', '-o', GetoptLong::REQUIRED_ARGUMENT],
+ [ '--unknown-user', GetoptLong::REQUIRED_ARGUMENT]
)
opts.each do |opt, arg|
@@ -99,6 +105,8 @@ class RedmineMailHandler
self.issue_attributes[opt.gsub(%r{^\-\-}, '')] = arg.dup
when '--allow-override'
self.allow_override = arg.dup
+ when '--unknown-user'
+ self.unknown_user = arg.dup
end
end
@@ -108,7 +116,9 @@ class RedmineMailHandler
def submit(email)
uri = url.gsub(%r{/*$}, '') + '/mail_handler'
- data = { 'key' => key, 'email' => email, 'allow_override' => allow_override }
+ data = { 'key' => key, 'email' => email,
+ 'allow_override' => allow_override,
+ 'unknown_user' => unknown_user }
issue_attributes.each { |attr, value| data["issue[#{attr}]"] = value }
debug "Posting to #{uri}..."