繁体   English   中英

如何获取登录当前会话的用户的ID?

[英]How to get the ID of the user who is logged into the current session?

我需要找到登录当前会话的用户。 我尝试了以下但不起作用:任何人都可以帮助我吗? 提前致谢!

$.get(CurrentServerAddress + '/service/v4/rest.php', {
    method: "get_user_id",
    input_type: "JSON",
    response_type: "JSON",
    rest_data:'"new_get_user_id":["session":"' + SugarSessionId + '"]'
}, function(data) {
    if (data !== undefined) {
        var userID = jQuery.parseJSON(data);
    }
});

我尝试了以下内容,它适用于我。

var userID = '';
    $.get(CurrentServerAddress + '/service/v4/rest.php', {
        method: "get_user_id",
        input_type: "JSON",
        response_type: "JSON",
        rest_data: '[{"session":"' + SugarSessionId + '"}]'
    }, function(data) {
        if (data !== undefined) {
            userID = jQuery.parseJSON(data);
        }
    });
'authenticated_user_id'

据我所知,这是你应该寻找的会议中的糖crm项目,你要求吗?

您正在进行的REST调用要求您拥有SESSION令牌。 通常,我们将在我们的CRM上设置一个REST用户,可以通过REST访问。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM