From a JIRA plugin, I want to know if a particular user is logged in. Is there an API available for it?
Also is there a list of API available to find out list of currently logged in users.
"user is logged in" is the wrong way to think about how user access works with services. When a user "logs in" with a shell or runs a program on a machine, there is a process that runs and you can point at that process and say "they are logged in".
With web applications such as Jira, you can not. A user requests that the service do something (show me a page, update an issue, etc) and the service does it. If there are "logins" and "user accounts", then the service will require credentials of some form so it can work out how to do it for the user (including if it is possible). The usual way to do this is to ask the user to "log in" and then create and store some "session" stuff, which may or may not expire, and are partially held on the client machine and the server.
But the sessions are not "logins". The user is only truly "logged in" for fractions of a second while they are actively getting the service to do something.
Sessions are not the same as being logged in. I have a Jira that I can visit now that I will go straight into with no "log in" because I was using it an hour ago. At the moment, there is no sign of me being "logged in" because I have no browser windows open with it, or REST scripts talking to it. But I do have a session open with it. I could also go to another machine, and open another session with it there.
You need to start with a think about what you really mean by "logged in". In my example above, would I be "logged in" twice with those two machines? When I have no browser windows open, am I "logged in"?
Hello @Subhajit Bhuiya
Yes, there are API for that.
Please check
So in plugin you need inject it via @ComponentImport
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Mark Markov It gives the current logged in user in the context. What I am looking is given a user id, JIRA to tell me if the user is currently logged in or may be an API which will give the list of users who are currently logged in
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.