Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I get the current user while handling Events (eg. PageCreateEvent)

Florian February 23, 2013

I extend a couple of Confluence Events in my plugin to create custom PDFs using the build-in PDF engine.

To create a PDF via FlyingSaucerPdfExporterService.createPdfForPage(user, page, contextpath) I need a user though I dont really know which one...

I guess it should be the curren user that is responsible for the event or maybe the admin. Sadly I coldnt find any documentation on what user FlyingSaucer expects or even how to get the current user of the Confluence Event.

Can anybody here point me in the right direction?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2013

You can probably try this:

Page newPage = event.getPage();
final User user = userAccessor.getUser(newPage.getCreatorName());

Gives you the user who created the page.

Florian February 24, 2013

For the user Accessor I used newPage.getContentEntityObject().getUserAccessor(); and it looks good so far.

I will test it and write back.

Florian February 24, 2013

There is something else that stops my plugin from working (https://answers.atlassian.com/questions/141213/how-can-i-create-a-pdf-in-my-own-plugin)but I am pretty sure the User is the correct one.

Thanks a lot!

TAGS
AUG Leaders

Atlassian Community Events