如何通过Rally App SDK获取登录用户(How to get the login user through Rally App SDK)

编程入门 行业动态 更新时间:2024-10-22 17:21:05
如何通过Rally App SDK获取登录用户(How to get the login user through Rally App SDK)

我使用其App SDK在Rally页面内创建了一个自定义html。 现在我想获取当前登录用户的用户名。 但我无法弄清楚如何做到这一点。

我注意到Rally提供了一些Hangman变量 ,当前用户名就是其中之一。 但是,当我们将其作为某些Rally API的参数传递时,它似乎才有意义。 但是,我需要获取用户名并在我的javascript代码中使用它。

我该怎么做?

I created a custom html inside the Rally page using its App SDK. Now I want to get the username of the current login user. But I cannot figure out how to do that.

I noticed Rally provides some Hangman Variables and current user name is one of them. But it seems it is only meaningful when we pass it as the parameter of some Rally API. However, I need to get the user name and use it in my javascript code.

How can I do it?

最满意答案

挂起变量被视为简单搜索,并在提供应用程序时由服务器替换,因此您可以将它们放在源中的任何位置。

var user = "__USER_NAME__";

当您的应用运行时,源代码如下所示:

var user = "vamcily";

在SDK 2.0中,这些hangmans仍然可用但不推荐使用。 您可以通过应用程序上下文获取有关当前用户的信息:

this.getContext().getUser();

The hangman variables are treated as simple search and replaces by the server when serving up your app so you can put them anywhere in the source.

var user = "__USER_NAME__";

When your app runs the source would look like this:

var user = "vamcily";

In SDK 2.0 these hangmans are still available but are deprecated. You can get information about the current user through the app context:

this.getContext().getUser();

更多推荐

本文发布于:2023-07-23 18:32:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1235609.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用户   App   Rally   SDK   user

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!