Qlik Community

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
New navigation header in progress. Thank you for your patience: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
thpessato
Contributor III
Contributor III

Forbidden app for the current user - Qlik Sense Mashup

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!

1 Solution

Accepted Solutions
ErikWetterberg

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

View solution in original post

5 Replies
ErikWetterberg

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

thpessato
Contributor III
Contributor III
Author

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)

ErikWetterberg

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

thpessato
Contributor III
Contributor III
Author

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!

thpessato
Contributor III
Contributor III
Author

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!!