QGIS API Documentation  3.23.0-Master (dd0cd13a00)
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 
50 class SERVER_EXPORT QgsAccessControlFilter
51 {
52 
53  public:
54 
60  QgsAccessControlFilter( const QgsServerInterface *serverInterface );
61 
62  virtual ~QgsAccessControlFilter() = default;
63 
66  {
67  bool canRead;
68  bool canUpdate;
69  bool canInsert;
70  bool canDelete;
71  };
72 
74  const QgsServerInterface *serverInterface() const { return mServerInterface; }
75 
81  virtual QString layerFilterExpression( const QgsVectorLayer *layer ) const;
82 
88  virtual QString layerFilterSubsetString( const QgsVectorLayer *layer ) const;
89 
95  virtual LayerPermissions layerPermissions( const QgsMapLayer *layer ) const;
96 
103  virtual QStringList authorizedLayerAttributes( const QgsVectorLayer *layer, const QStringList &attributes ) const;
104 
111  virtual bool allowToEdit( const QgsVectorLayer *layer, const QgsFeature &feature ) const;
112 
117  virtual QString cacheKey() const;
118 
119  private:
120 
122  const QgsServerInterface *mServerInterface = nullptr;
123 
124 };
125 
127 typedef QMultiMap<int, QgsAccessControlFilter *> QgsAccessControlFilterMap;
128 
129 
130 #endif // QGSSERVERSECURITY_H
Class defining access control interface for QGIS Server plugins.
virtual ~QgsAccessControlFilter()=default
const QgsServerInterface * serverInterface() const
Returns the QgsServerInterface instance.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:56
Base class for all map layer types.
Definition: qgsmaplayer.h:73
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins.
Represents a vector layer which manages a vector based data sets.
#define SIP_IF_MODULE(condition)
Definition: qgis_sip.h:28
QMultiMap< int, QgsAccessControlFilter * > QgsAccessControlFilterMap
The registry definition.