I’m currently writing a Confluence plugin which provides an API for receiving files and attaching these files to a page. The plugin runs with administrator privileges and so the default user/creator in that case for generated pages or attachments is always ‘anonymous’. I’m able to manually change the user of a plugin generated page via
ConfluenceEntityObject::setCreator (), but I cannot change the user of an attachment uploaded via the same plugin. There does not seem to be an API call for that.
ConfluenceUser user = ... // Creating the page. Setting the user is possible here Page page = templatePage.copyLatestVersion (); page.setCreator (user); // Attaching data to the page. There does not seem a way to set a user for the generated attachment. AttachmentResource attachment = new InputStreamAttachmentResource (new ByteArrayInputStream (data), name, format, data.length, comment); fileUploadManager.storeResource (attachment, page);
Is there a way to set the user for the attachment here, too ?
Thank you in advance !