It's all about the answers!

Ask a question

How can I get the current user from a server-side advisor?


Susan Hanson (1.6k2201194) | asked Sep 17 '14, 8:32 a.m.
I'm sure this is easy but I haven't been able to find it.

I need to get the "current user" from within the run() method of a validator.  I was hoping there was some nice API but didn't seem to find anything other than getting the "getModifiedBy()" from the newState() (which would then be the user who is going to be set as the person who last modified the work item).  Is there anything else?

Accepted answer


permanent link
sam detweiler (12.5k6195201) | answered Sep 17 '14, 8:45 a.m.
the AbstractService class provides

getAuthenticatedContributor();

in eclipse, enter a blank line, ctrl-spacebar will show all the methods available
Susan Hanson selected this answer as the correct answer

Comments
Susan Hanson commented Sep 17 '14, 8:51 a.m.

I figured it was easy ... I hadn't thought to check against the AbstractService class.  Perhaps I need to get more coffee before I start work :-)


sam detweiler commented Sep 17 '14, 8:57 a.m.

its always figuring out where to look.. way too many places most of the time.


Ralph Schoon commented Sep 17 '14, 10:14 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am sure I have blogged about it. Should be in here: https://rsjazz.wordpress.com/2014/05/26/only-owner-can-close-workitem-advisor/ .


sam detweiler commented Sep 17 '14, 10:19 a.m.

yes, I rarely search your blog for solutions (you are ahead of me on a few things!), more to help others..


Ralph Schoon commented Sep 17 '14, 10:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The whole point of the blog is to provide the typical examples. It works for a lot of people, I hope 8D


sam detweiler commented Sep 17 '14, 10:26 a.m.

yes.. as I said, I DO try to reference your content for others, who are learning like me, (before your blog existed).  but I don't know every line of code in your blog, so its a little hard..


Ralph Schoon commented Sep 17 '14, 10:34 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Me neither Sam. I use the search field and, after limiting down the hits, the browser search, when searching for API. This works very well, however, I have an advantage, that's for sure.

Thanks for helping here on the Forum Sam. You contribute a lot.


sam detweiler commented Sep 17 '14, 10:41 a.m.

my pleasure.

showing 5 of 8 show 3 more comments

Your answer


Register or to post your answer.