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

Remove "Could not retrieve users for UserCF" error message during issue creation

    XMLWordPrintable

Details

    Description

      Error message:

      2013-05-23 15:14:28,316 http-2990-8 INFO admin 914x6123x1 wu0ymg 172.28.13.175 /rest/api/latest/user/assignable/multiProjectSearch [jira.security.type.UserCF] Could not retrieve users for UserCF 'customfield_10000' since provided PermissionContext has no issue.

      Steps to reproduce:

      1. Create a user picker field.
      2. Add this field to the Assignable User permission in a project.
      3. Add this field to the create issue screen.
      4. Create a new issue, and try and select something in the Assignee field.
      5. Observe error message in logs

      This error does not actually break anything, it just adds spam to the logs. This was reported in 5.2.9 and confirmed in 6.0

      The relevant portion in the code is:

      /**
           * Get user specified by the Custom Field
           *
           * @param ctx           permission context
           * @param customFieldId eg. 'customfield_10000'
           * @return the set of users stored in the given custom field in the given context; an empty set is returned if the
           * context could not provide values (i.e. there was no issue specified).
           */
          @Override
          public Set<User> getUsers(PermissionContext ctx, String customFieldId)
          {
              // JRA-15063: just return EMPTY SET (like GroupCF does) because throwing an IllegalArgumentException is unnecessary.
              if (ctx.getIssue() == null)
              {
                  log.info("Could not retrieve users for UserCF '" + customFieldId + "' since provided PermissionContext has no issue.");
                  return Collections.EMPTY_SET;
              }
              Issue issue = ctx.getIssue();
              FieldManager fieldManager = getFieldManager();
              CustomField field = fieldManager.getCustomField(customFieldId);
              return convertToValueSet(getValuesFromIssue(field, issue));
          }

      When we look at what defines a PermissionContext we get:

       * Represents the context in which a permission evaluation is to be made.
       * Permission requests are of the form: subject, verb, object (eg. "User fred wishes to comment on ABC-123"), where:
       * subject = User object
       * verb = permission Id
       * object = Issue, project etc.
       * A PermissionContext encapsulates the object.

      So it sounds like we either need to make sure we are providing a correct PermissionContext during issue creation. It is impossible for the field to have a value during issue creation.

      This issue does NOT occur if the Assignee is set after the issue has been created.

      Workaround

      If you're getting a lot of these and not finding them useful, you can change the logging level for this class (com.atlassian.jira.security.type.UserCF) to WARN so that only WARN and ERROR messages are shown.

      Attachments

        Issue Links

          Activity

            People

              ohernandez@atlassian.com Oswaldo Hernandez (Inactive)
              bberenberg Boris Berenberg (Inactive)
              Votes:
              8 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: