How to set Issue security level depending on an Assets object attribute
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
In some scenarios, Jira issues have Assets Custom fields added to screens. You would like to make Jira issues visible only for users which are members of an Assets object attribute.
Assets Custom field has a type attribute User.
Here we will share a solution but it will also require some custom scripts.
環境
Assets or Insight Asset Management
ソリューション
The solution includes an issue-level security, Assets Post function and a custom script to be developed by customers.
要件
- Create a new 'User Picker' Jira Custom field
- The field will be populated by the value of your Assets object and it will also be used when selecting the appropriate security level
- Add an Issue Security Scheme - Configuring issue-level security
- When selecting 'Users / Groups / Project Roles' column, you need to select User custom field value and set it to the Jira Custom field created in Step #1
- Ensure to set issues security permission in the project permission scheme. This permission allows a user to set a security level.
- You can read more about it here Managing project permissions
- Assign the issue security scheme to a project
- Until this point, Insight or Assets are not involved in the configuration.
- Create an Assets Post function on Create/Update transaction to copy the value of Assets user attribute to the 'User Picker' Jira Custom field so the security level can be set.
- Insight Post function: Set a Jira custom field with the attribute value from a selected object
- Source custom field: Your Assets CF
- Insight Object Type Attribute name: Object attribute which hold the username
- Target custom field: The new Jira CF created in Step #1
Make sure the event occurs before an event called (Class: com.atlassian.jira.workflow.function.event.FireIssueEventFunction) which it's created by default and after (Re-index an issue to keep indexes in sync with the database). If you do not have them, please discard the alert.
- When an issue is created, Jira should only display issues to only users included in the 'User Picker' Jira Custom field which should be the same as your Assets CF.
その他
- The above solution works if users in the Assets Object attributes never get updated.
- If the Assets-Object attribute gets updated, with the current configuration described in this article, 'User Picker' Jira Custom field value will not get changed and the issue will still be visible to the previous user.
- A custom script is needed to fetch the Insight CF value (probably username) and then push it to 'User Picker' Jira Custom field value created in Step #1