Determine user of a comment in onCommentCreateEvent()-handler

Hi,

how can I determine the author/creator of a comment in the onCommentCreateEvent()-handler? I need to check whether the comment was created from a registered or an anonymous user.

So far I tried to use com.atlassian.confluence.user.AuthenticatedUserThreadLocal.isAnonymousUser() which worked in the dev environment, but fails on the production server. I assume that this is not the right way to determine the author of the comment. Any pointers in the right way to handle this?

Regards,
Stefan

CommentCreateEvent includes Comment which includes Creator. #getCreator returns ConfluenceUser type.

Thanks, @sfbehnke. That helped a lot.

1 Like