我使用服务从服务器端获取当前用户 AD 列表,
我在全局工具栏上创建了一个新操作,如果用户不属于相关广告,我会尝试隐藏该操作,
我正在使用 Action isVisible() 函数,但我不能让 isVisible() 等到服务答案返回,我做错了什么?
define([ "dojo/_base/declare","dojo/_base/lang", "ecm/model/Request", "ecm/model/Action","ecm/widget/dialog/AddContentItemDialog"],
function(declare,lang,
Request,Action,AddContentItemDialog) {
return declare("OpenEntryTemplatePluginDojo.OpenMyEntryTemplateAction",[ Action ], {
isUserBelogToSpecificADgroup:null,
isVisible:function(repository,listType){
if(!this.isUserBelogToSpecificADgroup){
Request.invokePluginService("OpenEntryTemplatePlugin","CheckIfCurrentUserHaveSpecificADgroupService",{//to know if the user is belong to the relevant AD group
requestCompleteCallback : dojo.hitch(this, function(response) {
if(response.success) {return response.success;}
else {
this.isUserBelogToSpecificADgroup = false;
return this.isUserBelogToSpecificADgroup ;
}
})
});
}else{
return false;
}
},```