Skip to content

Commit

Permalink
[BUGFIX][QGIS-Server] Restricted layers and layer id as name are inco…
Browse files Browse the repository at this point in the history
…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 585b82e
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/server/qgsserverprojectparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ QgsServerProjectParser::QgsServerProjectParser( QDomDocument* xmlDoc, const QStr
}
}

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

mCustomLayerOrder.clear();

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 585b82e

Please sign in to comment.