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 40459c6 commit 585b82eda0f5f21176609420fe654ccbeac674ce
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();

@@ -1068,6 +1068,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 585b82e

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