Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Removed unused and unuseful method + typo
  • Loading branch information
elpaso committed Nov 11, 2019
1 parent 20652c8 commit f5e4a7c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 78 deletions.
13 changes: 0 additions & 13 deletions python/server/auto_generated/qgsserverapiutils.sip.in
Expand Up @@ -111,19 +111,6 @@ This method takes into account the ACL restrictions provided by QGIS Server Acce
%End


static const QVector<QgsMapLayer *> editableWfsLayers( const QgsServerApiContext &context );
%Docstring
Returns the list of layers accessible to the service in edit mode for a given ``context``.

This method takes into account the ACL restrictions provided by QGIS Server Access Control plugins.

.. note::

project must not be NULL

.. versionadded:: 3.12
%End


static QString sanitizedFieldValue( const QString &value );
%Docstring
Expand Down
9 changes: 0 additions & 9 deletions src/server/qgsserverapiutils.cpp
Expand Up @@ -568,15 +568,6 @@ const QVector<QgsVectorLayer *> QgsServerApiUtils::publishedWfsLayers( const Qgs
return publishedWfsLayers< QgsVectorLayer * >( context );
}

const QVector<QgsMapLayer *> QgsServerApiUtils::editableWfsLayers( const QgsServerApiContext &context )
{
QVector<QgsMapLayer *> result;
const QStringList wfstUpdateLayerIds = QgsServerProjectUtils::wfstUpdateLayerIds( *context.project() );
const QStringList wfstInsertLayerIds = QgsServerProjectUtils::wfstInsertLayerIds( *context.project() );
const QStringList wfstDeleteLayerIds = QgsServerProjectUtils::wfstDeleteLayerIds( *context.project() );
return result;
}

QString QgsServerApiUtils::sanitizedFieldValue( const QString &value )
{
QString result { QUrl( value ).toString() };
Expand Down
52 changes: 0 additions & 52 deletions src/server/qgsserverapiutils.h
Expand Up @@ -201,58 +201,6 @@ class SERVER_EXPORT QgsServerApiUtils

#endif

/**
* Returns the list of layers accessible to the service in edit mode for a given \a context.
*
* This method takes into account the ACL restrictions provided by QGIS Server Access Control plugins.
*
* \note project must not be NULL
* \since QGIS 3.12
*/
static const QVector<QgsMapLayer *> editableWfsLayers( const QgsServerApiContext &context );

#ifndef SIP_RUN

/**
* Returns the list of layers of type T accessible to the WFS service in edit mode for a given \a project.
*
* Example:
*
* QVector<QgsVectorLayer*> vectorLayers = editableWfsLayers<QgsVectorLayer>();
*
* \note not available in Python bindings
*/
template <typename T>
static const QVector<T> editableWfsLayers( const QgsServerApiContext &context, QgsServerRequest::Method &method )
{
#ifdef HAVE_SERVER_PYTHON_PLUGINS
QgsAccessControl *accessControl = context.serverInterface()->accessControls();
#endif
const QgsProject *project = context.project();
QVector<T> result;
if ( project )
{
const QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project );
const auto constLayers { project->layers<T>() };
for ( const auto &layer : constLayers )
{
if ( ! wfsLayerIds.contains( layer->id() ) )
{
continue;
}
#ifdef HAVE_SERVER_PYTHON_PLUGINS
if ( accessControl && !accessControl->layerInsertPermission( layer ) )
{
continue;
}
#endif
result.push_back( layer );
}
}
return result;
}

#endif

/**
* Sanitizes the input \a value by removing URL encoding and checking for malicious content.
Expand Down
8 changes: 4 additions & 4 deletions src/server/services/wfs3/qgswfs3handlers.cpp
Expand Up @@ -1035,7 +1035,7 @@ json QgsWfs3CollectionsItemsHandler::schema( const QgsServerApiContext &context
{ "description", "Forbidden: the operation requested was not authorized" }
},
"500", {
{ "description", "Posted data could not be parsed correctly or another error occourred" }
{ "description", "Posted data could not be parsed correctly or another error occurred" }
}
},
{ "default", defaultResponse() }
Expand Down Expand Up @@ -1965,7 +1965,7 @@ json QgsWfs3CollectionsFeatureHandler::schema( const QgsServerApiContext &contex
{ "description", "Forbidden: the operation requested was not authorized" }
},
"500", {
{ "description", "Posted data could not be parsed correctly or another error occourred" }
{ "description", "Posted data could not be parsed correctly or another error occurred" }
}
},
{ "default", defaultResponse() }
Expand All @@ -1989,7 +1989,7 @@ json QgsWfs3CollectionsFeatureHandler::schema( const QgsServerApiContext &contex
{ "description", "Forbidden: the operation requested was not authorized" }
},
"500", {
{ "description", "Posted data could not be parsed correctly or another error occourred" }
{ "description", "Posted data could not be parsed correctly or another error occurred" }
}
},
{ "default", defaultResponse() }
Expand All @@ -2013,7 +2013,7 @@ json QgsWfs3CollectionsFeatureHandler::schema( const QgsServerApiContext &contex
{ "description", "Forbidden: the operation requested was not authorized" }
},
"500", {
{ "description", "Posted data could not be parsed correctly or another error occourred" }
{ "description", "Posted data could not be parsed correctly or another error occurred" }
}
},
{ "default", defaultResponse() }
Expand Down

0 comments on commit f5e4a7c

Please sign in to comment.