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

Simple means to obtain logged in user's id

    Details

    • Similar Issues:

      Description

      I've searched for a means to obtain the id of the currently logged in User, but incredibly this info is not easily queried.

      Existing solutions using User.current(), or Cause.UserIdCause() for triggered builds, are not reliable. User.current() results in SYSTEM whenever I try to use it. Cause.UserIdCause is only useful to me if I'm able to access it, and when I'm working with slaves it doesn't seem to be set for the master build triggered by a user.

      Yet, while I'm hunting around, I can see that the user id is always displaying in the top right corner of the UI, taunting me since it is the information I want, but seemingly not available.

      Surely this shouldn't be so hard or obtuse. If I just had the id, I could look up the User with a User.get(id) and be on my merry way.

      Thanks.

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            Remember that these methods are generally only meaningful within the dynamic scope of an HTTP request or CLI command. Use the dev mailing list or IRC if you still have issues.

            Show
            jglick Jesse Glick added a comment - Remember that these methods are generally only meaningful within the dynamic scope of an HTTP request or CLI command. Use the dev mailing list or IRC if you still have issues.
            Hide
            bmuchko Benjamin Muschko added a comment -

            This is still an issue and I don't quite understand why this JIRA ticket has been closed.

            Could you please clarify how to retrieve the currently logged-in user from a shared library? Is this currently possible or not? Everything I tried so far returns SYSTEM as mentioned above. The behavior is different from the use of those API calls from the Groovy console (which works as expected).

            Show
            bmuchko Benjamin Muschko added a comment - This is still an issue and I don't quite understand why this JIRA ticket has been closed. Could you please clarify how to retrieve the currently logged-in user from a shared library? Is this currently possible or not? Everything I tried so far returns SYSTEM as mentioned above. The behavior is different from the use of those API calls from the Groovy console (which works as expected).
            Hide
            jglick Jesse Glick added a comment -

            Reread the prior comments. There is no such thing as “the currently logged-in user from a shared library”.

            Show
            jglick Jesse Glick added a comment - Reread the prior comments. There is no such thing as “the currently logged-in user from a shared library”.
            Hide
            bmuchko Benjamin Muschko added a comment -

            Jesse Glick Thanks for confirming. Just for my and other people's understanding, could you also provide some technical details on why this functionality is not available?

            Show
            bmuchko Benjamin Muschko added a comment - Jesse Glick Thanks for confirming. Just for my and other people's understanding, could you also provide some technical details on why this functionality is not available?
            Hide
            jglick Jesse Glick added a comment -

            A build is not generally run with any association with a user whatsoever. The question just does not make sense. If a build happened to be triggered manually by a user (which is not the normal case), that information is already available via UserIdCause.

            Show
            jglick Jesse Glick added a comment - A build is not generally run with any association with a user whatsoever. The question just does not make sense. If a build happened to be triggered manually by a user (which is not the normal case), that information is already available via UserIdCause .

              People

              • Assignee:
                Unassigned
                Reporter:
                dankirkd Daniel Kirkdorffer
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: