Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a multiple QVF mashup and one of then is not available for the user. I want to show a friendly message, according to the app that is forbidden.
I could not find anything that solves my problem yet.
Is there a way to know if an app is forbidden or not for a user, inside a mashup?
Thanks!
No, I'm sorry there isn't. The onError method should catch this though. There is also the undocumented waitForOpen promise (I think it's at app.model.waitForOpen), that probably would work (I haven't tested).
You don't need to open a separate web socket to get the app list. You can use app.global. But catching open errors would mean less overhead, since getting the app list might be slow, if you have many apps and access rules that don't evaluate super quickly.
Erik Wetterberg
Hi,
If the user has no access to the app it will not be visible, so openApp will fail. You could catch this error. Another approach is to get the users list of available app either over the web socket through the Capabilities API or with a call to the QRS API.
Hope this helps
Erik Wetterberg
Since openApp will fail, I was hoping there's something like this:
qlik.openApp(...,..).then(function(app){
//do stuff on success
}, function(error){
//do stuff on fail
});
Is there something like this? (without opening a web socket just to do this)
No, I'm sorry there isn't. The onError method should catch this though. There is also the undocumented waitForOpen promise (I think it's at app.model.waitForOpen), that probably would work (I haven't tested).
You don't need to open a separate web socket to get the app list. You can use app.global. But catching open errors would mean less overhead, since getting the app list might be slow, if you have many apps and access rules that don't evaluate super quickly.
Erik Wetterberg
I see.. The onError doesn't tell me which app is forbidden, it just gives me the message... at least that's what I saw while debugging... I'll try the waitForOpen, it seems interesting
Thanks Erik!
Hey Erik,
Using waitForOpen, I managed to solve my problem. When going to reject function, I can use the 'error.message' along with the opened app.
app.model.waitForOpen.promise.then(function(response){
console.log(response);
}, function(e){
if(e.error.message == 'Forbidden') {
console.log(app.id);
}
});
That way, I can tell which app is forbidden, by it's ID, so the user can have more information about the problem
Thanks!!