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.
Try this way to get the User ID:
Tridion.UI.UserSettings.getJsonUserSettings(true).User["@ID"]
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