Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-47718

Deprecate User.getUser(String)

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved (View Workflow)
    • Minor
    • Resolution: Fixed
    • core
    • None

    Description

      User#getUser() method causes lots of confusion for plugin developers. It implicitly creates a user if it cannot be found, and in many cases this is actually a not-expected behavior

      I propose to deprecate the method and to create a new User#getOrCreate() which would be more explicit

      Attachments

        Issue Links

          Activity

            oleg_nenashev Oleg Nenashev added a comment -

            The API misusage also causes JENKINS-23281 in some cases

            oleg_nenashev Oleg Nenashev added a comment - The API misusage also causes JENKINS-23281 in some cases

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            core/src/main/java/hudson/model/Cause.java
            core/src/main/java/hudson/model/Run.java
            core/src/main/java/hudson/model/User.java
            core/src/main/java/jenkins/scm/RunWithSCM.java
            http://jenkins-ci.org/commit/jenkins/8cb3351319358c056556bd568f0e883d982f6d22
            Log:
            JENKINS-47718 - Deprecate User#getUser(String) (#3114)

            `User#getUser(String)` method causes lots of confusion for plugin developers. It implicitly creates a user if it cannot be found, and in many cases this is actually a not-expected behavior. This change deprecates the method and to creates a new `User#getOrCreate()` which is more explicit

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/model/Cause.java core/src/main/java/hudson/model/Run.java core/src/main/java/hudson/model/User.java core/src/main/java/jenkins/scm/RunWithSCM.java http://jenkins-ci.org/commit/jenkins/8cb3351319358c056556bd568f0e883d982f6d22 Log: JENKINS-47718 - Deprecate User#getUser(String) (#3114) JENKINS-47718 - Deprecate User#getUser(String) `User#getUser(String)` method causes lots of confusion for plugin developers. It implicitly creates a user if it cannot be found, and in many cases this is actually a not-expected behavior. This change deprecates the method and to creates a new `User#getOrCreate()` which is more explicit JENKINS-47718 - Address comments from @jglick
            oleg_nenashev Oleg Nenashev added a comment -

            This change has been integrated towards 2.91

            oleg_nenashev Oleg Nenashev added a comment - This change has been integrated towards 2.91

            People

              oleg_nenashev Oleg Nenashev
              oleg_nenashev Oleg Nenashev
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: