[xwiki-users] Getting user name with a Java Component
Some time last year I had to write a component for XWiki 6.3 that required the current user name, which following the advice at the time required injecting a DocumentAccessBridge: @Inject private DocumentAccessBridge documentAccessBridge; and then calling documentAccessBridge.getCurrentUserReference().getName()) This has the consequence of having to pull in the xwiki-core-bridge module from the XWiki Remote Maven repo, rather than just using the XWiki Commons code in Maven Central. At the time, Vincent mentioned (http://xwiki.475771.n2.nabble.com/Getting-user-name-with-a-Java-Component-td...) "You're right, our goal is to have all context information (including the user) be put in the Execution Context." I'm now having to rewrite some of this component, and I'm now using XWiki 7.1.1. Has there been any development in shifting the user name over to the Execution Context so that I can avoid using the bridge module? Thanks, Bryn
DocumentAccessBridge is still the current way to get the context user. Now the way ExecutionContext has been designed it will always be generic and you are supposed to use specialised API to access something like the current user (you are not supposed to know how exactly it's stored in the context) and user concept will probably always be a XWiki Platform concept anyway. Now we would like to put Platform in Maven central but we still have lots of dependencies that are not there. On Fri, Jul 31, 2015 at 9:06 AM, Bryn Jeffries <[email protected]> wrote:
Some time last year I had to write a component for XWiki 6.3 that required the current user name, which following the advice at the time required injecting a DocumentAccessBridge:
@Inject private DocumentAccessBridge documentAccessBridge;
and then calling documentAccessBridge.getCurrentUserReference().getName())
This has the consequence of having to pull in the xwiki-core-bridge module from the XWiki Remote Maven repo, rather than just using the XWiki Commons code in Maven Central.
At the time, Vincent mentioned (http://xwiki.475771.n2.nabble.com/Getting-user-name-with-a-Java-Component-td...) "You're right, our goal is to have all context information (including the user) be put in the Execution Context."
I'm now having to rewrite some of this component, and I'm now using XWiki 7.1.1. Has there been any development in shifting the user name over to the Execution Context so that I can avoid using the bridge module?
Thanks,
Bryn _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
Thomas Mortagne wrote:
DocumentAccessBridge is still the current way to get the context user.
Now the way ExecutionContext has been designed it will always be generic and you are supposed to use specialised API to access something like the current user (you are not supposed to know how exactly it's stored in the context) and user concept will probably always be a XWiki Platform concept anyway. Now we would like to put Platform in Maven central but we still have lots of dependencies that are not there.
Fair enough. For some reason I'm really struggling to include the right repository for Platform. What details should I be using in my settings.xml? I've included everything from the example in http://dev.xwiki.org/xwiki/bin/view/Community/Building but I still can't resolve the dependency. Thanks, Bryn
On Fri, Jul 31, 2015 at 9:47 AM, Bryn Jeffries <[email protected]> wrote:
Thomas Mortagne wrote:
DocumentAccessBridge is still the current way to get the context user.
Now the way ExecutionContext has been designed it will always be generic and you are supposed to use specialised API to access something like the current user (you are not supposed to know how exactly it's stored in the context) and user concept will probably always be a XWiki Platform concept anyway. Now we would like to put Platform in Maven central but we still have lots of dependencies that are not there.
Fair enough. For some reason I'm really struggling to include the right repository for Platform. What details should I be using in my settings.xml? I've included everything from the example in http://dev.xwiki.org/xwiki/bin/view/Community/Building but I still can't resolve the dependency.
What's in http://dev.xwiki.org/xwiki/bin/view/Community/Building#HInstallingMaven should be enough, that's exactly what I have on my side.
Thanks,
Bryn
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
I wrote:
Fair enough. For some reason I'm really struggling to include the right repository for Platform. What details should I be using in my settings.xml? I've included everything from the example in http://dev.xwiki.org/xwiki/bin/view/Community/Building but I still can't resolve the dependency.
Thomas Mortagne replied:
What's in http://dev.xwiki.org/xwiki/bin/view/Community/Building#HInstallingMaven should be enough, that's exactly what I have on my side.
You're right, it's working now. Must have been a slow Maven index rebuild. Many thanks, Bryn
participants (2)
-
Bryn Jeffries -
Thomas Mortagne