首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Javascript获取用户Jive权限组的列表

使用Javascript获取用户Jive权限组的列表
EN

Stack Overflow用户
提问于 2015-08-03 15:00:50
回答 1查看 811关注 0票数 2

我试图获得一个用户的Jive权限组的列表。如何用jQuery来完成这个任务呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-03 15:00:50

使用Jive v3 API并不难。最糟糕的是,您必须对Jive的结果进行消毒,才能使其有效。谢天谢地,您可以使用Datafilter。

代码语言:javascript
复制
// We will use this as our data filter in the AJAX call

sanitizeJiveJsonResponse: function(response){
    return response.replace("throw 'allowIllegalResourceCall is false.';", '');
},

// You can get the logged in user id from the __jive variable. Including any sort     
// of JS in a Jive widget or tile will cause that code to run from an iframe, so      
// we're using window.parent to reference it

var userid = window.parent._jive_current_user.ID;
if(typeof userid == 'undefined'){
    // Error stuff here
}

$.ajax({

    url: '/api/core/v3/people/' + userid + '/securityGroups',
    context: document.body,
    dataType: 'json',
    dataFilter: function (data, type) {
        return sanitizeJiveJsonResponse(data);
    }

    }).done(function(result) {
        // Your success code here...
    });
};

希望这能有所帮助!

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31790605

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档