如何在 JavaScript 代码中检索当前登录用户的 TCM URI? [英] How can I retrieve TCM URI of the currently logged in user in JavaScript code?

查看:19
本文介绍了如何在 JavaScript 代码中检索当前登录用户的 TCM URI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将当前登录用户的 TCM URI 检索到 Tridion?

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

我正在 Tridion 2011 上开发 GUI 扩展,需要检查组件是否已检出给当前登录的用户.我计划将当前登录用户的 TCM URI 与 component.getLockedById() 进行比较.

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().

我很确定我在查看 Tridion 的 JavaScript 文件时看到了如何在某处检索当前登录用户的用户名.

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();

推荐答案

我还没有机会对此进行测试,但值得浏览 SDL Tridion 2011 Powertools 项目.有一个实用程序文件位于:

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);

我相信这是一段标准的 UI 代码,而不是自定义的 PowerTools 函数

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

这篇关于如何在 JavaScript 代码中检索当前登录用户的 TCM URI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆