在SAP Cloud Platform中的Fiori app中如何获得登陆用户名?

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/berryreload/article/details/76451521

SCP WebIDE中,打开Fiori app项目,编辑neo-app.json文件
“routes”: [
{
“path”: “/services/userapi”, //application path to be forwarded
“target”: {
“type”: “service”,
“name”: “userapi”
}
}
]

// set user model
var userModel = new sap.ui.model.json.JSONModel();
userModel.loadData("/services/userapi/currentUser", null, false);
this.setModel(userModel, "userapi");

运行该Fiori app,浏览器修改URL地址
https://webidetesting7004004-p00000trial.dispatcher.hanatrial.ondemand.com/services/userapi/currentUser

返回结果:
{“name”:”P100000”,”firstName”:”Jiang”,”lastName”:”Yang”,”email”:”yangjiang2k@gmail.com”,”displayName”:”Jiang Yang (P100000)”}

参考:
https://stackoverflow.com/questions/39370754/how-to-get-scisap-cloud-identity-account-info-in-hcp-portal-service

阅读更多 登录后自动展开
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页