Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-11546

CreateIssue do not set Reporter to specified value

    XMLWordPrintable

Details

    Description

      I am currently preparing many import using CreateIssue tag with enterprise release, it appears that with as such script :

      <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib" >
      <jira:CreateIssue project-key="AP00517" summary="My Summary ..." duplicateSummary="ignore" priority="Haute" issuetype="20100" assignee="182388" reporter="182614" 
      description="My description ... " created="2004-07-23 00:00:00.0" timetracking="48000" >
      </jira:CreateIssue>
      </JiraJelly>

      Executed with Admin account, the Reporter is never set to the specified value.

      The excution Tag sequence is as follow :

      • com.atlassian.jira.jelly.tag.issue.enterprise.CreateIssue.preContextValidation() is called
        • com.atlassian.jira.jelly.tag.issue.AbstractCreateIssue.preContextValidation()
          • if (getProperties().containsKey(KEY_ISSUE_REPORTER)) {
               setPreviousUsername(getUsername());
               getContext().setVariable(JellyTagConstants.USERNAME, getProperty(KEY_ISSUE_REPORTER.toLowerCase()));
            }
        • delegation to Webwork Action CreateIssueDetails
        • com.atlassian.jira.jelly.tag.issue.AbstractCreateIssue.endContextValidation()
          • if (hasPreviousUsername)
               getContext().setVariable(JellyTagConstants.USERNAME, getPreviousUsername());

      But in com.atlassian.jira.issue.fields.ReporterSystemField, the following methods are called :

      public void populateDefaults(Map fieldValuesHolder, Issue issue) {
         User remoteUser = (User) getDefaultValue(issue);
         if (remoteUser != null)
            fieldValuesHolder.put(getId(), remoteUser.getName());
      }
      public Object getDefaultValue(Issue issue) {
         // The default value that should be set if the user cannot modify this field is the remote user's name
         return getAuthenticationContext().getUser();
      }

      The JiraAuthenticationContext should be altered in the AbstractCreateIssue as it is has been already done for AddComment tag :

      String reporterName = getProperty(KEY_ISSUE_REPORTER);
      try {
         User reporter = ((UserManager)ComponentManager.getInstance().getContainer().getComponentInstanceOfType(UserManager.class)).getUser(reporterName);
         ComponentManager.getInstance().getJiraAuthenticationContext().setUser(reporter);
      }
      catch (EntityNotFoundException e) {
         log.warn("Reporter named " + reporterName + " not found. Creating issue with currently logged in user instead");
      }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              5d77aaa81033 Vincent Thoulé
              Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 2h
                  2h
                  Remaining:
                  Remaining Estimate - 2h
                  2h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified