Skip to content
Permalink
Browse files

[Server] Remove QgsProject::instance

  • Loading branch information
rldhont committed Sep 6, 2017
1 parent a35af0c commit d8cf02e0836cd9e9db9f66fb2ce5d65e7cabcbc3
@@ -305,7 +305,6 @@ void QgsServer::handleRequest( QgsServerRequest &request, QgsServerResponse &res
{
QgsMessageLog::MessageLevel logLevel = QgsServerLogger::instance()->logLevel();
QTime time; //used for measuring request time if loglevel < 1
QgsProject::instance()->removeAllMapLayers();

qApp->processEvents();

@@ -1686,20 +1686,6 @@ namespace QgsWms
return true;
}

#ifdef HAVE_SERVER_PYTHON_PLUGINS
void QgsRenderer::applyAccessControlLayersFilters( const QStringList &layerList, QHash<QgsMapLayer *, QString> &originalLayerFilters ) const
{
Q_FOREACH ( const QString &layerName, layerList )
{
QList<QgsMapLayer *> mapLayers = QgsProject::instance()->mapLayersByName( layerName );
Q_FOREACH ( QgsMapLayer *mapLayer, mapLayers )
{
QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( mAccessControl, mapLayer, originalLayerFilters );
}
}
}
#endif

bool QgsRenderer::testFilterStringSafety( const QString &filter ) const
{
//; too dangerous for sql injections
@@ -1897,7 +1883,7 @@ namespace QgsWms
QString currentLayerId = currentLayerElem.attribute( QStringLiteral( "id" ) );
if ( !currentLayerId.isEmpty() )
{
QgsMapLayer *currentLayer = QgsProject::instance()->mapLayer( currentLayerId );
QgsMapLayer *currentLayer = mProject->mapLayer( currentLayerId );
if ( currentLayer )
{
QString WMSPropertyAttributesString = currentLayer->customProperty( QStringLiteral( "WMSPropertyAttributes" ) ).toString();
@@ -2109,7 +2095,7 @@ namespace QgsWms

QgsExpressionContext expressionContext;
expressionContext << QgsExpressionContextUtils::globalScope()
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() );
<< QgsExpressionContextUtils::projectScope( mProject );
if ( layer )
expressionContext << QgsExpressionContextUtils::layerScope( layer );
expressionContext.setFeature( *feat );
@@ -224,15 +224,6 @@ namespace QgsWms
//! Record which symbols within one layer would be rendered with the given renderer context
void runHitTestLayer( QgsVectorLayer *vl, SymbolSet &usedSymbols, QgsRenderContext &context ) const;

#ifdef HAVE_SERVER_PYTHON_PLUGINS

/** Apply filter strings from the access control to the layers.
* \param layerList layers to filter
* \param originalLayerFilters the original layers filter dictionary
*/
void applyAccessControlLayersFilters( const QStringList &layerList, QHash<QgsMapLayer *, QString> &originalLayerFilters ) const;
#endif

/** Tests if a filter sql string is allowed (safe)
\returns true in case of success, false if string seems unsafe*/
bool testFilterStringSafety( const QString &filter ) const;

0 comments on commit d8cf02e

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