How can I retrieve TCM URI of the currently logged in user in JavaScript code?

流过昼夜 提交于 2019-12-08 20:55:38

问题


How can I retrieve the TCM URI of the currently logged in user to Tridion?

I am developing a GUI extension on Tridion 2011 and need to check whether a Component has been checked out to the currently logged in user or not. I plan on comparing the currently logged in user's TCM URI to component.getLockedById().

I'm fairly sure I saw how to retrieve the currently logged in user's username somewhere when looking at Tridion's JavaScript files.

EDIT
I've found out one way to retrieve the username at least:

var username = Tridion.ContentManager.UserSettings.getInstance().getUserName();

回答1:


I have not had a chance to test this, but it is worth looking through the SDL Tridion 2011 Powertools project. There is a Utilities file at:

http://code.google.com/p/tridion-2011-power-tools/source/browse/trunk/PowerTools.Editor/PowerTools/Client/Shared/Scripts/utils.js

That may help you. I think the line you may be looking for is

this._userSettings = Tridion.UI.UserSettings.getJsonUserSettings(true);

I believe that is a standard piece of UI code rather than a custom PowerTools function



来源:https://stackoverflow.com/questions/10171158/how-can-i-retrieve-tcm-uri-of-the-currently-logged-in-user-in-javascript-code

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