How to get the user Id of the currently logged user in Tridion?

最后都变了- 提交于 2019-12-07 18:59:30

问题


I implemented a Ribbon tool bar button in the Tridion. As part of that I need to loop through the some components, which requires a valid session.

To create a session in the Tridion I require a User Id. How to get the User Id of the current user(windows User Id)?

Will the following command help us to get the user info? If so please let me know the usage of the command.

getJsonUserSettings();

Thanks in advance. Early response is appreciated.


回答1:


Try this way to get the User ID:

Tridion.UI.UserSettings.getJsonUserSettings(true).User["@ID"]



回答2:


In c# you can use Tridion.Web.UI.Core.Utils.GetUserName()

This will return the LOGIN name of the user, which you need - for instance - to impersonate.

I fumbled for a few seconds in Chrome's Console and came up with this for the user name - there may be an easier way to do it.

Tridion.ContentManager.UserSettings.getInstance().getUserName()

EDIT: As mentioned by Frank, this is a duplicate of How can I retrieve TCM URI of the currently logged in user in JavaScript code?

Not a bad idea to start searching before posting...



来源:https://stackoverflow.com/questions/10891689/how-to-get-the-user-id-of-the-currently-logged-user-in-tridion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!