QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
qgsaccesscontrol.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsaccesscontrol.h
3 ------------------
4 begin : 22-05-2015
5 copyright : (C) 2008 by Stéphane Brunner
6 email : stephane dot brunner at camptocamp dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSACCESSCONTROL_H
19#define QGSACCESSCONTROL_H
20
23
24#include "qgis_server.h"
25#include "qgis_sip.h"
26
27SIP_IF_MODULE( HAVE_SERVER_PYTHON_PLUGINS )
28
29
30
35class SERVER_EXPORT QgsAccessControl : public QgsFeatureFilterProvider
36{
37#ifdef SIP_RUN
39#endif
40
41 public:
44 {
45 mPluginsAccessControls = new QgsAccessControlFilterMap();
46 mResolved = false;
47 }
48
51 {
52 mPluginsAccessControls = new QgsAccessControlFilterMap( *copy.mPluginsAccessControls );
53 mFilterFeaturesExpressions = copy.mFilterFeaturesExpressions;
54 mResolved = copy.mResolved;
55 }
56
57
59 {
60 delete mPluginsAccessControls;
61 }
62
64 QgsAccessControl &operator= ( const QgsAccessControl &other )
65 {
66 if ( this != &other )
67 {
68 delete mPluginsAccessControls;
69 mPluginsAccessControls = new QgsAccessControlFilterMap( *other.mPluginsAccessControls );
70 mFilterFeaturesExpressions = other.mFilterFeaturesExpressions;
71 mResolved = other.mResolved;
72 }
73 return *this;
74 }
75
85 void resolveFilterFeatures( const QList<QgsMapLayer *> &layers );
86
90 void unresolveFilterFeatures();
91
97 void filterFeatures( const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures ) const override;
98
103 QgsFeatureFilterProvider *clone() const override SIP_FACTORY;
104
110 QString extraSubsetString( const QgsVectorLayer *layer ) const;
111
117 bool layerReadPermission( const QgsMapLayer *layer ) const;
118
124 bool layerInsertPermission( const QgsVectorLayer *layer ) const;
125
131 bool layerUpdatePermission( const QgsVectorLayer *layer ) const;
132
138 bool layerDeletePermission( const QgsVectorLayer *layer ) const;
139
146 QStringList layerAttributes( const QgsVectorLayer *layer, const QStringList &attributes ) const override;
147
154 bool allowToEdit( const QgsVectorLayer *layer, const QgsFeature &feature ) const;
155
160 bool fillCacheKey( QStringList &cacheKey ) const;
161
167 void registerAccessControl( QgsAccessControlFilter *accessControl, int priority = 0 );
168
169 private:
170 QString resolveFilterFeatures( const QgsVectorLayer *layer ) const;
171
173 QgsAccessControlFilterMap *mPluginsAccessControls = nullptr;
174
175 QMap<QString, QString> mFilterFeaturesExpressions;
176 bool mResolved;
177
178};
179
180#endif
Class defining access control interface for QGIS Server plugins.
A helper class that centralizes restrictions given by all the access control filter plugins.
~QgsAccessControl() override
QgsAccessControl()
Constructor.
QgsAccessControl(const QgsAccessControl &copy)
Constructor.
Abstract interface for use by classes that filter the features or attributes of a layer.
This class wraps a request for features to a vector layer (or directly its vector data provider).
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:75
Represents a vector layer which manages a vector based data sets.
#define SIP_IF_MODULE(condition)
Definition qgis_sip.h:28
#define SIP_FACTORY
Definition qgis_sip.h:76
QMultiMap< int, QgsAccessControlFilter * > QgsAccessControlFilterMap
The registry definition.