Skip to content
Permalink
Browse files

[BUGFIX][QGIS-Server] Restricted layers and layer id as name are inco…

…mpatible

If the user checks 'used layer id as name' and specifies 'restricted layers',
 the restriction is not applied.

To fix it, I add the layer ids to the restricted layers list.
  • Loading branch information
rldhont committed Oct 6, 2015
1 parent c0e4927 commit 95e829dee7847e910b45a28ed7022e1841ebc132
Showing with 23 additions and 1 deletion.
  1. +23 −1 src/server/qgsserverprojectparser.cpp
@@ -62,8 +62,8 @@ QgsServerProjectParser::QgsServerProjectParser( QDomDocument* xmlDoc, const QStr
}
}

mRestrictedLayers = findRestrictedLayers();
mUseLayerIDs = findUseLayerIDs();
mRestrictedLayers = findRestrictedLayers();

mCustomLayerOrder.clear();

@@ -1072,6 +1072,28 @@ QSet<QString> QgsServerProjectParser::findRestrictedLayers() const
}
}
}

// wmsLayerRestrictionValues contains LayerIDs
if ( mUseLayerIDs )
{
QDomNodeList legendLayerList = legendElem.elementsByTagName( "legendlayer" );
for ( int i = 0; i < legendLayerList.size(); ++i )
{
//get name
QDomElement layerElem = legendLayerList.at( i ).toElement();
QString layerName = layerElem.attribute( "name" );
if ( restrictedLayerSet.contains( layerName ) ) //match: add layer id
{
// get legend layer file element
QDomNodeList layerfileList = layerElem.elementsByTagName( "legendlayerfile" );
if ( layerfileList.size() > 0 )
{
// add layer id
restrictedLayerSet.insert( layerfileList.at( 0 ).toElement().attribute( "layerid" ) );
}
}
}
}
return restrictedLayerSet;
}

0 comments on commit 95e829d

Please sign in to comment.
You can’t perform that action at this time.