How to use ContentService in DiscoverableListener

Hi

From my experience developing migration routine using DiscoverableListener you dont have a user in the current context (bound to current thread).

I think I have seen somewhere a workaround to find “first user with admin privileges” and use that (setting thread local yourself before using Confluence user-aware APIs).

BTW, same goes with a transaction context - you dont have an “open session” there, need to inject TransactionTemplate if you want to have it

Alex

3 Likes