Subtask does not inherit Issue Security Level of parent

ConradR
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2013

Hi,

my default security level restricts the access to internal users and a "Group Custom Field Value". This works fine.

When I create a subtask by hand, it inherits the Issue Security Level of its parent.

But when I create a subtask in my code on an issue event, the subtask doesn't inherit the Issue Security Level of its parent.

My EventListener calls the following method:

private void createDevelopmentSubtask(Issue issue, User initiator) throws CreateException {


        MutableIssue mutableSubtask = issueFactory.getIssue();
        mutableSubtask.setProjectObject(issue.getProjectObject());
        mutableSubtask.setIssueTypeId(DEVELOPMENT_SUBTASK_ID);
        mutableSubtask.setParentId(issue.getId());
        mutableSubtask.setSummary("Development-Subtask: " + issue.getSummary());
        mutableSubtask.setReporter(initiator);
        mutableSubtask.setPriorityObject(issue.getPriorityObject());
        mutableSubtask.setAffectedVersions(issue.getAffectedVersions());
        mutableSubtask.setFixVersions(issue.getFixVersions());
        mutableSubtask.setComponentObjects(issue.getComponentObjects());
        mutableSubtask.setLabels(issue.getLabels());

        Issue subTask = issueManager.createIssueObject(initiator, mutableSubtask);
        subTaskManager.createSubTaskIssueLink(issue, subTask, initiator);

        log.info("Created Subtask: " + subTask.getSummary());
    }

The User "initiator" has the right to set security levels. I also tried a reindex before and after the "createSubTaskIssueLink()" without success.

Any ideas?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted
ConradR
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2013

I could get it work with

mutableSubtask.setSecurityLevelId(issue.getSecurityLevelId());

It seems, subtasks just inherit the security level if you create them via the Jira UI. So when you create them via code, you have to set the securityLevelId as shown above.

If you don't set the securityLevelId, the subtask doesn't inherit the level until you update the level of the parent task.

0 votes
Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2013

Subtasks automatically inherit security level of the parent issue , there is no field such as security level for subtasks .

TAGS
AUG Leaders

Atlassian Community Events