QGIS API Documentation  3.8.0-Zanzibar (11aff65)
qgsaccesscontrolfilter.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsaccesscontrolfilter.h
3  ------------------------
4  Access control interface for Qgis Server plugins
5 
6  begin : 2015-05-19
7  copyright : (C) 2015 by St├ęphane Brunner
8  email : stephane dot brunner at camptocamp dot org
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
20 #ifndef QGSACCESSCONTROLPLUGIN_H
21 #define QGSACCESSCONTROLPLUGIN_H
22 
23 #include <QMultiMap>
24 #include <QString>
25 #include "qgis_server.h"
26 #include "qgis_sip.h"
27 
28 SIP_IF_MODULE( HAVE_SERVER_PYTHON_PLUGINS )
29 
30 class QgsServerInterface;
31 class QgsMapLayer;
32 class QgsVectorLayer;
33 class QgsFeature;
34 
35 
49 class SERVER_EXPORT QgsAccessControlFilter
50 {
51 
52  public:
53 
59  QgsAccessControlFilter( const QgsServerInterface *serverInterface );
60 
61  virtual ~QgsAccessControlFilter() = default;
62 
65  {
66  bool canRead;
67  bool canUpdate;
68  bool canInsert;
69  bool canDelete;
70  };
71 
73  const QgsServerInterface *serverInterface() const { return mServerInterface; }
74 
80  virtual QString layerFilterExpression( const QgsVectorLayer *layer ) const;
81 
87  virtual QString layerFilterSubsetString( const QgsVectorLayer *layer ) const;
88 
94  virtual LayerPermissions layerPermissions( const QgsMapLayer *layer ) const;
95 
102  virtual QStringList authorizedLayerAttributes( const QgsVectorLayer *layer, const QStringList &attributes ) const;
103 
110  virtual bool allowToEdit( const QgsVectorLayer *layer, const QgsFeature &feature ) const;
111 
116  virtual QString cacheKey() const;
117 
118  private:
119 
121  const QgsServerInterface *mServerInterface = nullptr;
122 
123 };
124 
126 typedef QMultiMap<int, QgsAccessControlFilter *> QgsAccessControlFilterMap;
127 
128 
129 #endif // QGSSERVERSECURITY_H
Base class for all map layer types.
Definition: qgsmaplayer.h:78
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:55
#define SIP_IF_MODULE(condition)
Definition: qgis_sip.h:28
Class defining access control interface for QGIS Server plugins.
const QgsServerInterface * serverInterface() const
Returns the QgsServerInterface instance.
QMultiMap< int, QgsAccessControlFilter * > QgsAccessControlFilterMap
The registry definition.
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins...
Represents a vector layer which manages a vector based data sets.