Changes for page The identity of the current user is now available in javascript
Last modified by Vincent Massol on 2021/04/06
From version 1.1
edited by Guillaume Delhumeau
on 2018/05/09
on 2018/05/09
Change comment:
There is no comment for this version
To version 2.1
edited by Guillaume Delhumeau
on 2018/05/09
on 2018/05/09
Change comment:
There is no comment for this version
Summary
-
Objects (1 modified, 0 added, 0 removed)
Details
- ReleaseNotes.Code.ChangesClass[0]
-
- summary
-
... ... @@ -1,8 +1,8 @@ 1 -JavaScript developers can now get the f ull serialization of the current user(e.g. ##xwiki:XWiki.Admin##)thanks to the [[##xwiki-meta## module>>doc:Documentation.DevGuide.FrontendResources.JavaScriptAPI.WebHome||anchor="HGetsomeinformationaboutthecurrentdocument"]] that you can use like this:1 +JavaScript developers can now get the reference of the current user thanks to the [[##xwiki-meta## module>>doc:Documentation.DevGuide.FrontendResources.JavaScriptAPI.WebHome||anchor="HGetsomeinformationaboutthecurrentdocument"]] that you can use like this: 2 2 3 3 {{code language="javascript"}} 4 4 require(['xwiki-meta'], function (xm) { 5 - console.log('Hello: ' + xm.user Id);5 + console.log('Hello: ' + XWiki.Model.serialize(xm.userReference)); 6 6 // Will display "Hello xwiki:XWiki.Admin" in the console 7 7 }); 8 8 {{/code}}