Jira incoming mail handler processes the email using an incorrect user
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
問題
When a user sends an email to the incoming mail handler, the email is either not processed or is processed using an incorrect user.
If the emails are not processed, warnings informing that the user is lacking application access can be observed in the atlassian-jira-incoming-mail.log
files, even though within the UI the user does have application access.
2019-01-01 20:00:00,000 WARN [Jira Mailhandler] Caesium-1-4 anonymous Jira Mailhandler Jira Mailhandler[10001]: Cannot create issue due to invalid license: [Sorry, you can't create any issues right now, as you need to have access to a Jira application to be able to create issues. To gain application access you need to be a member of a group assigned to an application.]
原因
When multiple users with the same email address exist in the Jira database, Jira will use the first username that matches the email address.
例:
The instance has the following users in the database.
ID | DIRECTORY_ID | ACTIVE | LOWER_USER_NAME | LOWER_EMAIL_ADDRESS |
---|---|---|---|---|
50 | 1 | 0 | catlassian | charlie.atlassian@mail.com |
68 | 10001 | 1 | charlie.atlassian | charlie.atlassian@mail.com |
In this scenario, directory 10001 is the topmost directory.
In the Jira UI, the user catlassian
will be disabled and does not have application access. However, if an email is received by charlie.atlassian@mail.com, the application will select the user catlassian
to create an issue or comment as this user has a lower ID and is thus queried prior to the correct user. This will result in the following error:
2019-01-01 20:00:00,000 WARN [Jira Mailhandler] Caesium-1-4 anonymous Jira Mailhandler Jira Mailhandler[10001]: Cannot create issue due to invalid license: [Sorry, you can't create any issues right now, as you need to have access to a Jira application to be able to create issues. To gain application access you need to be a member of a group assigned to an application.]
診断
This behavior can be verified by querying the database for the email address. For example, for the email address charlie.atlassian@mail.com:
SELECT id, directory_id, active, lower_user_name, lower_email_address FROM cwd_user WHERE lower_email_address = 'charlie.atlassian@mail.com';
出力:
ID | DIRECTORY_ID | ACTIVE | LOWER_USER_NAME | LOWER_EMAIL_ADDRESS |
---|---|---|---|---|
50 | 1 | 0 | catlassian | charlie.atlassian@mail.com |
68 | 10001 | 1 | charlie.atlassian | charlie.atlassian@mail.com |
回避策
There are two workarounds for this issue;
- Align the username between the two directories.
- If the first option is not possible, modify the email address of the incorrect user so that it no longer matches an existing user.
UPDATE cwd_user SET email_address = 'inactive@localhost', lower_email_address = 'inactive@localhost' WHERE lower_email_address = 'charlie.atlassian@mail.com' AND id = '50';
データベースの変更を行う場合は必ず事前にバックアップを取得してください。可能な場合は、まずステージング サーバーで SQL コマンドの変更、挿入、更新、または削除を行うようにします。