Listener to monitor large attachments

Filip Labarque December 2, 2019

Hi,

I've created a listener in Scriptrunner for Confluence to monitor the upload of large attachments. I can get the attachment info (name, type, size) but how can I get the info on who uploaded the attachment (username, email)?

I'm using the AttachmentCreateEvent.

1 answer

1 accepted

0 votes
Answer accepted
Ilya Turov
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.
December 3, 2019

I guess you can get list of attachments from the event (or a single attachment) and then look for those attachments creator(s).

I believe attachment's creator would be same person as the user who uploaded it.

event.attachment

would return you an Attachment object, then you can get the ConfluenceUser object from it by doing 

attachment.creator

and user then has (full)name and email fields you can access. well, it's all in the docs

Filip Labarque December 3, 2019

Thanks, in the mean time I've used:

user = AuthenticatedUserThreadLocal.get()

But I like your solution better. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events