2014-10-10 19:28:20 +02:00
|
|
|
/***************************************************************************
|
|
|
|
qgsserverinterface.sip
|
|
|
|
|
2015-05-29 10:19:51 +02:00
|
|
|
Class defining the interface made available to QGIS Server plugins.
|
2014-10-10 19:28:20 +02:00
|
|
|
-------------------
|
|
|
|
begin : 2014-09-10
|
|
|
|
copyright : (C) 2014 by Alessandro Pasotti
|
|
|
|
email : a dot pasotti at itopen dot it
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2014-10-09 15:05:19 +02:00
|
|
|
/**
|
2016-10-01 11:23:26 +02:00
|
|
|
* \ingroup server
|
|
|
|
* QgsServerInterface
|
|
|
|
* Class defining interfaces exposed by QGIS Server and
|
|
|
|
* made available to plugins.
|
2014-10-09 15:05:19 +02:00
|
|
|
*
|
2014-10-10 19:28:20 +02:00
|
|
|
* This class provides methods to access the request handler and
|
|
|
|
* the capabilties cache. A method to read the environment
|
|
|
|
* variables set in the main FCGI loop is also available.
|
|
|
|
* Plugins can add listeners (instances of QgsServerFilter) with
|
|
|
|
* a certain priority through the registerFilter( QgsServerFilter* , int) method.
|
2016-10-01 11:23:26 +02:00
|
|
|
*
|
2014-10-09 15:05:19 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
typedef QMultiMap<int, QgsServerFilter*> QgsServerFiltersMap;
|
|
|
|
|
2015-08-04 20:55:42 +02:00
|
|
|
|
|
|
|
|
2014-10-09 15:05:19 +02:00
|
|
|
class QgsServerInterface
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsserverinterface.h"
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2016-10-01 11:23:26 +02:00
|
|
|
/**
|
|
|
|
* Set the request handler
|
|
|
|
* @param requestHandler request handler
|
|
|
|
* @note not available in Python bindings
|
|
|
|
*/
|
|
|
|
// virtual void setRequestHandler( QgsRequestHandler* requestHandler ) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear the request handler
|
|
|
|
*
|
|
|
|
* @note not available in python bindings
|
|
|
|
*/
|
|
|
|
// virtual void clearRequestHandler() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get pointer to the capabiblities cache
|
|
|
|
* @return QgsCapabilitiesCache
|
|
|
|
*/
|
|
|
|
virtual QgsCapabilitiesCache* capabilitiesCache() = 0 /KeepReference/;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get pointer to the request handler
|
|
|
|
* @return QgsRequestHandler
|
|
|
|
*/
|
2016-02-14 03:50:23 +01:00
|
|
|
virtual QgsRequestHandler* requestHandler() = 0 /KeepReference/;
|
2016-10-01 11:23:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a QgsServerFilter
|
|
|
|
* @param filter the QgsServerFilter to add
|
|
|
|
* @param priority an optional priority for the filter order
|
|
|
|
*/
|
2014-10-09 15:05:19 +02:00
|
|
|
virtual void registerFilter( QgsServerFilter* filter /Transfer/, int priority = 0 ) = 0;
|
2016-10-01 11:23:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the filters map
|
|
|
|
* @param filters the QgsServerFiltersMap
|
|
|
|
*/
|
2015-08-06 17:51:26 +02:00
|
|
|
virtual void setFilters( QgsServerFiltersMap* filters /Transfer/) = 0;
|
2016-10-01 11:23:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the list of current QgsServerFilter
|
|
|
|
* @return QgsServerFiltersMap list of QgsServerFilter
|
|
|
|
*/
|
|
|
|
virtual QgsServerFiltersMap filters() = 0;
|
|
|
|
|
|
|
|
/** Register an access control filter
|
|
|
|
* @param accessControl the access control to register
|
|
|
|
* @param priority the priority used to order them
|
|
|
|
*/
|
The plugin define the following methods:
* layerFilterExpression
Return an additional filter, used in
WMS/GetMap, WMS/GetFeatureInfo, WFS/GetFeature to filter the features
* layerFilterSubsetString
Return an additional the subset string (typically SQL) filter.
Faster than the layerFilterExpression but not supported on all the
type of layer
* layerPermissions
Change the rights on the layer per user (known by the plugin)
Concern rights: publish, insert, update, delete.
Mostly used in WFS/Transaction, and the publish in all requests.
* authorizedLayerAttributes
Be able to show some attributes only for a subset of user
Used in: WMS/GetFeatureInfo, WFS/GetFeature
* allowToEdit
Be able to don't allow to edit a particular feature, in our case base
on the Geometry
Used in: WFS/Transaction
* cacheKey
Cache key to used to create the capabilities cache, "" for no cache,
shouldn't contains any "-", default to ""
2015-05-19 15:53:51 +02:00
|
|
|
virtual void registerAccessControl( QgsAccessControlFilter* accessControl /Transfer/, int priority = 0 ) = 0;
|
2016-10-01 11:23:26 +02:00
|
|
|
|
2016-01-04 22:51:18 +11:00
|
|
|
/** Gets the registred access control filters */
|
2016-02-14 03:50:23 +01:00
|
|
|
virtual const QgsAccessControl* accessControls() const = 0;
|
2016-10-01 11:23:26 +02:00
|
|
|
|
|
|
|
//! Return an enrironment variable, used to pass environment variables to python
|
2014-10-09 17:06:07 +02:00
|
|
|
virtual QString getEnv(const QString& name ) const = 0;
|
2016-10-01 11:23:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the configuration file path
|
|
|
|
* @return QString containing the configuration file path
|
|
|
|
*/
|
2016-02-14 03:50:23 +01:00
|
|
|
virtual QString configFilePath() = 0;
|
2016-10-01 11:23:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the configuration file path
|
|
|
|
* @param configFilePath QString with the configuration file path
|
|
|
|
*/
|
2015-11-16 09:10:26 +11:00
|
|
|
virtual void setConfigFilePath( const QString& configFilePath) = 0;
|
2016-10-01 11:23:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove entry from config cache
|
|
|
|
* @param path the path of the file to remove
|
|
|
|
*/
|
2016-04-21 15:09:01 +02:00
|
|
|
virtual void removeConfigCacheEntry( const QString& path ) = 0;
|
|
|
|
|
2016-10-01 11:23:26 +02:00
|
|
|
/**
|
|
|
|
* Remove entries from layer cache
|
|
|
|
* @param path the path of the project which own the layers to be removed
|
|
|
|
*/
|
|
|
|
virtual void removeProjectLayers( const QString& path ) = 0;
|
2014-10-09 15:05:19 +02:00
|
|
|
|
2016-10-01 11:23:26 +02:00
|
|
|
private:
|
2014-10-09 15:05:19 +02:00
|
|
|
/** Constructor */
|
2016-02-14 03:50:23 +01:00
|
|
|
QgsServerInterface();
|
2014-10-09 15:05:19 +02:00
|
|
|
};
|
|
|
|
|