AnsweredAssumed Answered

Only load layers from map services user has access to

Question asked by msereda on May 26, 2014
Latest reply on Feb 25, 2016 by cleotokos

I have a set of map services that I load in my JSAPI app (v3.9), but different users have access to different map services through the app (using windows auth).  The app will throw an error (as expected) if the user doesn't have access to a particular map service when I try to add the layers to the map, but when there's an error loading any of the map services, the app won't fire the layers-add-result event.

My code essentially boils down to this:'layers-add-result', lang.hitch(this, 'doStuff'));

// Here I add some ArcGISDynamicMapServiceLayer layers here to the 'layers' object.;

What I'd like to be able to do is to only add layers to the map that the user has access to.  I think this would be similar to doing a check to see if a map service is up before trying to add a layer to the map from it, ie 'check if map service is available - if yes, add layer to map' kind of thing.

Is this possible to do?