Windows Authentication for managing GIS Services

818
6
10-03-2011 01:06 PM
JamesBerg
New Contributor III
I get the following error message when I open my flexviewer application that has a service I don't have permission to view.

T101 Tickets layer failed to load: Fault code: 499
Fault info: Unauthorized access

My goal is to have services controlled by Active Directory Groups but not have to have multiple config files for each user group.  I'd like to list all the layers that can be in the viewer but just not show data for the users that don't have permission to see the data.  For instance if you have data for police precincts and you only want people in their own precinct to be able to see their data I would create different services that filter the data by precinct and then assign permissions so that the AD users in the precinct group can only see the services that are assigned to their AD Group.  Then city wide for the higher ups they could see all services or have a service that allows them to see all data with no filters.

So two questions am I on the right track and if so why do I get this error above?
Tags (2)
0 Kudos
6 Replies
ErwanCaradec
New Contributor II
Hi James,
i had the same problem, different feature services updated by differents AD Groups and i didn't want to make one flex map for each group.

I made a modification in the MapManager.mxml file, so now when a secured service can't be loaded with this error : "499 - Unauthorized access", there's no error popup displayed and the layer is removed from the map.layers list.
If you want to try it (for FlexViewer 2.4) replace lines 833 and 834 with this code in the MapManager.mxml :
// Modif erwan.caradec 03/11/2011
// Remove application error "499 - Unauthorized access" when a secured service can't be loaded and remove the layer from the map
// old lines :    
//#833                var errorMessage:String = event.layer.name + " layer failed to load: " + makeHTMLSafe(buildFaultMessage(event.fault));
//#834     AppEvent.showError(errorMessage);

// new lines :
    if (event.fault.faultCode != "499") {
     var errorMessage:String = event.layer.name + " layer failed to load: " + makeHTMLSafe(buildFaultMessage(event.fault));
     AppEvent.showError(errorMessage);     
    } else {
     map.removeLayer(event.layer);
    }
// fin des modifs


Erwan
0 Kudos
BrentFoster
New Contributor II
Anyone doing something similar to this in Flex 3.4?  This would save me from having to create multitudes of viewers..
0 Kudos
TrevorWeiland
New Contributor III
Could this maybe be an option in the config.xml of the compiled version?
0 Kudos
MichaelVolz
Esteemed Contributor
Making this a configurable option would be awesome!!!
0 Kudos
BrentFoster
New Contributor II
Commenting out line 674 fixes this issue.  Still doesn't address the issue of having widgets that are now pointing to a map service that's no longer in the map, but at least its a start. 

[HTML]private function layer_loadErrorEvent(event:LayerEvent):void
            {
                event.layer.removeEventListener(LayerEvent.LOAD_ERROR, layer_loadErrorEvent);
                event.layer.removeEventListener(LayerEvent.LOAD, layer_loadEvent);

                if (event.fault.faultString != "Sign in aborted")
                {
                    var errorMessage:String = LocalizationUtil.getDefaultString("layerFailedToLoad",
                                                                                event.layer.name,
                                                                                ErrorMessageUtil.makeHTMLSafe(ErrorMessageUtil.buildFaultMessage(event.fault)));

//                    AppEvent.showError(errorMessage, MAP_MANAGER);
                }
                // remove layer from map and map switcher
                removeLayerFromLayerObject(event.layer);
                map.removeLayer(event.layer);[/HTML]
0 Kudos
MattiasEkström
Occasional Contributor III
Just commenting out that line fix the issue of unwanted error messages, but will also hide all kind of error messages when a layer fails to load. I'd like to just hide the error message when it's caused by the user not being authorized. Unfortunately I haven't found a real solution to this. I've asked about this in this thread http://forums.arcgis.com/threads/88942-Check-if-a-user-is-authorized-to-a-specific-secured-map-servi...
where I've also described my "not-so-good-solution" to check for a specific error message, the "not-so-good" part is that I assume the specific error message isn't that specific and could be caused by a number of reasons...
0 Kudos