QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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
QgsAccessControlFilter::LayerPermissions
Describe the layer permission.
Definition: qgsaccesscontrolfilter.h:65
QgsAccessControlFilterMap
QMultiMap< int, QgsAccessControlFilter * > QgsAccessControlFilterMap
The registry definition.
Definition: qgsaccesscontrolfilter.h:127
QgsAccessControlFilter::LayerPermissions::canInsert
bool canInsert
Definition: qgsaccesscontrolfilter.h:69
QgsAccessControlFilter::LayerPermissions::canDelete
bool canDelete
Definition: qgsaccesscontrolfilter.h:70
QgsAccessControlFilter::LayerPermissions::canUpdate
bool canUpdate
Definition: qgsaccesscontrolfilter.h:68
QgsAccessControlFilter::serverInterface
const QgsServerInterface * serverInterface() const
Returns the QgsServerInterface instance.
Definition: qgsaccesscontrolfilter.h:74
QgsAccessControlFilter
Class defining access control interface for QGIS Server plugins.
Definition: qgsaccesscontrolfilter.h:50
qgis_sip.h
SIP_IF_MODULE
#define SIP_IF_MODULE(condition)
Definition: qgis_sip.h:28
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsMapLayer
Definition: qgsmaplayer.h:81
QgsAccessControlFilter::LayerPermissions::canRead
bool canRead
Definition: qgsaccesscontrolfilter.h:67
QgsFeature
Definition: qgsfeature.h:55
QgsServerInterface
Definition: qgsserverinterface.h:60