How can I get the current user from a server-side advisor?
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
getAuthenticatedContributor();
in eclipse, enter a blank line, ctrl-spacebar will show all the methods available
Comments
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 :-)
its always figuring out where to look.. way too many places most of the time.
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/ .
yes, I rarely search your blog for solutions (you are ahead of me on a few things!), more to help others..
The whole point of the blog is to provide the typical examples. It works for a lot of people, I hope 8D
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..
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.
my pleasure.