小部件如何确定登录WireCloud的用户? [英] How a widget can figure out the user logged in WireCloud?

查看:85
本文介绍了小部件如何确定登录WireCloud的用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为小部件开发人员,我希望根据WireCloud中登录的用户在小部件中显示不同的信息.

As widget developer, I would like to show different information in my widget depending of the user that is logged in WireCloud.

该小部件如何确定加载时在WireCloud中登录的用户是谁?

How could the widget figure out who is the user that is logged in WireCloud when it is loaded?

推荐答案

WireCloud提供了对访问MashupPlatform API当前可用的上下文信息的支持.当前,WireCloud同时提供用户名和用户全名:

WireCloud provides support for accessing context information currently available through the MashupPlatform API. Currently WireCloud provides both the username and the full name of the user:

var username = MashupPlatform.context.get('username');
var realname = MashupPlatform.context.get('fullname');

看看 WireCloud的课程@ FIWARE Academy 了解有关如何处理小部件/操作符的上下文信息的更多信息.

Take a look into the "3.1.5. Accessing context information" section of the WireCloud's course @ FIWARE Academy for more info about how handle context information from widgets/operators.

这篇关于小部件如何确定登录WireCloud的用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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