QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 <QList>
25 #include <QString>
26 #include "qgis_server.h"
27 #include "qgis_sip.h"
28 
29 SIP_IF_MODULE( HAVE_SERVER_PYTHON_PLUGINS )
30 
31 class QgsServerInterface;
32 class QgsMapLayer;
33 class QgsVectorLayer;
34 class QgsExpression;
35 class QgsFeature;
36 
37 
51 class SERVER_EXPORT QgsAccessControlFilter
52 {
53 
54  public:
55 
61  QgsAccessControlFilter( const QgsServerInterface *serverInterface );
62 
63  virtual ~QgsAccessControlFilter() = default;
64 
67  {
68  bool canRead;
69  bool canUpdate;
70  bool canInsert;
71  bool canDelete;
72  };
73 
75  const QgsServerInterface *serverInterface() const { return mServerInterface; }
76 
82  virtual QString layerFilterExpression( const QgsVectorLayer *layer ) const;
83 
89  virtual QString layerFilterSubsetString( const QgsVectorLayer *layer ) const;
90 
96  virtual LayerPermissions layerPermissions( const QgsMapLayer *layer ) const;
97 
104  virtual QStringList authorizedLayerAttributes( const QgsVectorLayer *layer, const QStringList &attributes ) const;
105 
112  virtual bool allowToEdit( const QgsVectorLayer *layer, const QgsFeature &feature ) const;
113 
118  virtual QString cacheKey() const;
119 
120  private:
121 
123  const QgsServerInterface *mServerInterface = nullptr;
124 
125 };
126 
128 typedef QMultiMap<int, QgsAccessControlFilter *> QgsAccessControlFilterMap;
129 
130 
131 #endif // QGSSERVERSECURITY_H
Class for parsing and evaluation of expressions (formerly called "search strings").
Base class for all map layer types.
Definition: qgsmaplayer.h:63
const QgsServerInterface * serverInterface() const
Returns the QgsServerInterface instance.
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.
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.