OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Allow project and other attributes to be set in cron
Oliver Günther9adc02c6eaba
diff --git a/docker/prod/cron b/docker/prod/cronindex 2ae51fdaad1..c0b7e5c6921 100755--- a/docker/prod/cron+++ b/docker/prod/cron@@ -15,9 +15,17 @@ while true; dohost="${IMAP_HOST}" \username="${IMAP_USERNAME}" \password="${IMAP_PASSWORD}" \- ssl=${IMAP_SSL} \- ssl_verification=${IMAP_SSL_VERIFICATION} \- port=${IMAP_PORT} \+ ssl="${IMAP_SSL}" \+ ssl_verification="${IMAP_SSL_VERIFICATION}" \+ port="${IMAP_PORT}" \+ folder="${IMAP_FOLDER}" \+ project="${IMAP_ATTR_PROJECT}" \+ category="${IMAP_ATTR_CATEGORY}" \+ priority="${IMAP_ATTR_PRIORITY}" \+ status="${IMAP_ATTR_STATUS}" \+ version="${IMAP_ATTR_VERSION}" \+ type="${IMAP_ATTR_TYPE}" \+ assigned_to="${IMAP_ATTR_ASSIGNED_TO}" \unknown_user="${IMAP_UNKNOWN_USER}" \no_permission_check="${IMAP_NO_PERMISSION_CHECK}" \move_on_success="${IMAP_MOVE_ON_SUCCESS}" \diff --git a/docs/installation-and-operations/configuration/incoming-emails/README.md b/docs/installation-and-operations/configuration/incoming-emails/README.mdindex 2940443c487..bfbccbf5fe8 100644--- a/docs/installation-and-operations/configuration/incoming-emails/README.md+++ b/docs/installation-and-operations/configuration/incoming-emails/README.md@@ -47,31 +47,30 @@ Optional ENV variables:Available arguments for this rake task that specify the email behavior are-|key | description|-|----|------------|-| `host` | address of the email server |-| `username` | the name of the user that is used to connect to the email server|-| `password` | the password of the user|-| `port` | the port that is used to connect to the email server|-| `ssl` | specifies if SSL should be used when connecting to the email server|-| `folder` | the folder to fetch emails from (default: INBOX)|-| `move_on_success` | the folder emails that were successfully parsed are moved to (instead of deleted)|-| `move_on_failure` | the folder emails that were ignored are moved to|+|key |Docker ENV variable | description|+|----|------------|------------|+| `host` | `IMAP_HOST` | address of the email server |+| `username` | `IMAP_USERNAME` | the name of the user that is used to connect to the email server|+| `password` | `IMAP_PASSWORd` | the password of the user|+| `port` | `IMAP_PORT` | the port that is used to connect to the email server|+| `ssl` | `IMAP_SSL` and ``IMAP_SSL_VERIFICATION` | specifies if SSL should be used when connecting to the email server|+| `folder` | `IMAP_FOLDER` | the folder to fetch emails from (default: INBOX)|+| `move_on_success` | `IMAP_MOVE_ON_SUCCESS` | the folder emails that were successfully parsed are moved to (instead of deleted)|+| `move_on_failure` | `IMAP_MOVE_ON_FAILURE` | the folder emails that were ignored are moved to|Available arguments that change how the work packages are handled:-| key | description |-|---|---|-| `project` | identifier of the target project |-| `tracker` | name of the target tracker |-| `category` | name of the target category |-| `priority` | name of the target priority |-| `status` | name of the target status |-| `version` | name of the target version |-| `type` | name of the target type |-| `priority` | name of the target priority |-| `unknown_user` | ignore: email is ignored (default), accept: accept as anonymous user, create: create a user account |-| `allow_override` | specifies which attributes may be overwritten though specified by previous options. Comma separated list |+| key | Docker ENV variable | description |+|---|---|---|+| `project` | `IMAP_ATTR_PROJECT` | identifier of the target project |+| `category` | `IMAP_ATTR_CATEGORY` | name of the target category |+| `priority` | `IMAP_ATTR_PRIORITY` | name of the target priority |+| `status` | `IMAP_ATTR_STATUS` | name of the target status |+| `version` | `IMAP_ATTR_VERSION` | name of the target version |+| `type` | `IMAP_ATTR_TYPE` | name of the target type |+| `assigned_to` | `IMAP_ATTR_ASSIGNED_TO` | name of the assigned user |+| `unknown_user` | `IMAP_UNKNOWN_USER` | ignore: email is ignored (default), accept: accept as anonymous user, create: create a user account |+| `allow_override` | `IMAP_ALLOW_OVERRIDE` | specifies which attributes may be overwritten though specified by previous options. Comma separated list |**Gmail API**@@ -85,15 +84,15 @@ In order to use the more secure Gmail API method, some extra initial setup in go7. Give the service account editor permissions and click "Done"8. Click on the new service account, go to the "Keys" tab, and add a new key.9. Save the JSON key file- ***Note: Do not give anyone access to this JSON file as it contains the private key to your service account!***+ ***Note: Do not give anyone access to this JSON file as it contains the private key to your service account!***10. Go to https://admin.google.com11. Select Security > Access and Data Control > API Controls12. Go to "Domain-Wide Delegation"13. Add new API Client14. Open JSON key file and copy "client_id" number15. Enter `https://www.googleapis.com/auth/gmail.modify` into the scopes- ***Note: Modify permissions are necessary here to mark emails as read***- ***This is so the service account can access all accounts in your Domain***+ ***Note: Modify permissions are necessary here to mark emails as read***+ ***This is so the service account can access all accounts in your Domain***Available arguments for the Gmail API rake task that specify the email behavior arediff --git a/lib/redmine/imap.rb b/lib/redmine/imap.rbindex 7870c18a1b1..2fdf0f0e833 100644--- a/lib/redmine/imap.rb+++ b/lib/redmine/imap.rb@@ -32,7 +32,7 @@ module Redminemodule IMAPclass << selfdef check(imap_options = {}, options = {})- folder = imap_options[:folder] || 'INBOX'+ folder = imap_options[:folder].presence || 'INBOX'imap = connect_imap(imap_options)imap.select(folder)diff --git a/lib/tasks/email.rake b/lib/tasks/email.rakeindex f9de94ad4d7..51d07ed09c6 100644--- a/lib/tasks/email.rake+++ b/lib/tasks/email.rake@@ -233,7 +233,7 @@ namespace :redmine do{ issue: {} }.tap do |options|default_fields = ENV.fetch('default_fields', '').splitdefault_fields |= %w[project status type category priority assigned_to version]- default_fields.each { |field| options[:issue][field.to_sym] = ENV[field] if ENV[field] }+ default_fields.each { |field| options[:issue][field.to_sym] = ENV[field] if ENV[field].present? }options[:allow_override] = ENV['allow_override'] if ENV['allow_override']options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user']