使用 Javascript 获取用户的 Jive 权限组列表
Using Javascript to get a list of a user's Jive Permission Groups
我正在尝试获取用户的 Jive SBS 权限组列表。 jQuery 将如何完成?
使用 Jive v3 API 这并不难。最糟糕的是,您必须清理 Jive 的结果以使其有效 JSON。谢天谢地,您可以使用 Datafilter。
// 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...
});
};
希望对您有所帮助!
我正在尝试获取用户的 Jive SBS 权限组列表。 jQuery 将如何完成?
使用 Jive v3 API 这并不难。最糟糕的是,您必须清理 Jive 的结果以使其有效 JSON。谢天谢地,您可以使用 Datafilter。
// 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...
});
};
希望对您有所帮助!