QGIS API Documentation 3.41.0-Master (cea29feecf2)
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
50 {
51 mPluginsAccessControls = new QgsAccessControlFilterMap( *copy.mPluginsAccessControls );
52 mFilterFeaturesExpressions = copy.mFilterFeaturesExpressions;
53 mResolved = copy.mResolved;
54 }
55
56
58 {
59 delete mPluginsAccessControls;
60 }
61
63 {
64 if ( this != &other )
65 {
66 delete mPluginsAccessControls;
67 mPluginsAccessControls = new QgsAccessControlFilterMap( *other.mPluginsAccessControls );
68 mFilterFeaturesExpressions = other.mFilterFeaturesExpressions;
69 mResolved = other.mResolved;
70 }
71 return *this;
72 }
73
83 void resolveFilterFeatures( const QList<QgsMapLayer *> &layers );
84
88 void unresolveFilterFeatures();
89
95 void filterFeatures( const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures ) const override;
96
101 QgsFeatureFilterProvider *clone() const override SIP_FACTORY;
102
108 QString extraSubsetString( const QgsVectorLayer *layer ) const;
109
115 bool layerReadPermission( const QgsMapLayer *layer ) const;
116
122 bool layerInsertPermission( const QgsVectorLayer *layer ) const;
123
129 bool layerUpdatePermission( const QgsVectorLayer *layer ) const;
130
136 bool layerDeletePermission( const QgsVectorLayer *layer ) const;
137
144 QStringList layerAttributes( const QgsVectorLayer *layer, const QStringList &attributes ) const override;
145
152 bool allowToEdit( const QgsVectorLayer *layer, const QgsFeature &feature ) const;
153
158 bool fillCacheKey( QStringList &cacheKey ) const;
159
165 void registerAccessControl( QgsAccessControlFilter *accessControl, int priority = 0 );
166
167 private:
168 QString resolveFilterFeatures( const QgsVectorLayer *layer ) const;
169
171 QgsAccessControlFilterMap *mPluginsAccessControls = nullptr;
172
173 QMap<QString, QString> mFilterFeaturesExpressions;
174 bool mResolved;
175};
176
177#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)
QgsAccessControl & operator=(const QgsAccessControl &other)
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:58
Base class for all map layer types.
Definition qgsmaplayer.h:76
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.