40 QStringList expressions = QStringList();
41 QgsAccessControlFilterMap::const_iterator acIterator;
43 for ( acIterator = mPluginsAccessControls->constBegin(); acIterator != mPluginsAccessControls->constEnd(); ++acIterator )
45 QString expression = acIterator.value()->layerFilterExpression( layer );
46 if ( !expression.isEmpty() )
48 expressions.append( expression );
53 if ( !expressions.isEmpty() )
55 expression = QStringLiteral(
"((" ).append( expressions.join( QLatin1String(
") AND (" ) ) ).append(
"))" );
67 if ( mResolved && mFilterFeaturesExpressions.contains( layer->
id() ) )
69 expression = mFilterFeaturesExpressions[layer->
id()];
76 if ( !expression.isEmpty() )
92 QgsAccessControlFilterMap::const_iterator acIterator;
93 for ( acIterator = mPluginsAccessControls->constBegin(); acIterator != mPluginsAccessControls->constEnd(); ++acIterator )
95 QString sql = acIterator.value()->layerFilterSubsetString( layer );
101 return sqls.isEmpty() ? QString() : QStringLiteral(
"((" ).append( sqls.join( QLatin1String(
") AND (" ) ) ).append(
"))" );
107 QgsAccessControlFilterMap::const_iterator acIterator;
108 for ( acIterator = mPluginsAccessControls->constBegin(); acIterator != mPluginsAccessControls->constEnd(); ++acIterator )
110 if ( !acIterator.value()->layerPermissions( layer ).canRead )
121 QgsAccessControlFilterMap::const_iterator acIterator;
122 for ( acIterator = mPluginsAccessControls->constBegin(); acIterator != mPluginsAccessControls->constEnd(); ++acIterator )
124 if ( !acIterator.value()->layerPermissions( layer ).canInsert )
135 QgsAccessControlFilterMap::const_iterator acIterator;
136 for ( acIterator = mPluginsAccessControls->constBegin(); acIterator != mPluginsAccessControls->constEnd(); ++acIterator )
138 if ( !acIterator.value()->layerPermissions( layer ).canUpdate )
149 QgsAccessControlFilterMap::const_iterator acIterator;
150 for ( acIterator = mPluginsAccessControls->constBegin(); acIterator != mPluginsAccessControls->constEnd(); ++acIterator )
152 if ( !acIterator.value()->layerPermissions( layer ).canDelete )
163 QStringList currentAttributes( attributes );
164 QgsAccessControlFilterMap::const_iterator acIterator;
165 for ( acIterator = mPluginsAccessControls->constBegin(); acIterator != mPluginsAccessControls->constEnd(); ++acIterator )
167 currentAttributes = acIterator.value()->authorizedLayerAttributes( layer, currentAttributes );
169 return currentAttributes;
175 QgsAccessControlFilterMap::const_iterator acIterator;
176 for ( acIterator = mPluginsAccessControls->constBegin(); acIterator != mPluginsAccessControls->constEnd(); ++acIterator )
178 if ( !acIterator.value()->allowToEdit( layer, feature ) )
189 QgsAccessControlFilterMap::const_iterator acIterator;
190 for ( acIterator = mPluginsAccessControls->constBegin(); acIterator != mPluginsAccessControls->constEnd(); ++acIterator )
192 QString newKey = acIterator.value()->cacheKey();
193 if ( ! newKey.isEmpty() )
205 mPluginsAccessControls->insert( priority, accessControl );
Class defining access control interface for QGIS Server plugins.
QStringList layerAttributes(const QgsVectorLayer *layer, const QStringList &attributes) const override
Returns the authorized layer attributes.
bool layerUpdatePermission(const QgsVectorLayer *layer) const
Returns the layer update right.
void filterFeatures(const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures) const override
Filter the features of the layer.
bool layerInsertPermission(const QgsVectorLayer *layer) const
Returns the layer insert right.
bool layerReadPermission(const QgsMapLayer *layer) const
Returns the layer read right.
bool fillCacheKey(QStringList &cacheKey) const
Fill the capabilities caching key.
bool allowToEdit(const QgsVectorLayer *layer, const QgsFeature &feature) const
Are we authorized to modify the following geometry.
QgsFeatureFilterProvider * clone() const override
Returns a clone of the object.
bool layerDeletePermission(const QgsVectorLayer *layer) const
Returns the layer delete right.
void resolveFilterFeatures(const QList< QgsMapLayer * > &layers)
Resolve features' filter of layers.
void registerAccessControl(QgsAccessControlFilter *accessControl, int priority=0)
Register an access control filter.
QgsAccessControl()
Constructor.
QString extraSubsetString(const QgsVectorLayer *layer) const
Returns an additional subset string (typically SQL) filter.
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).
QgsFeatureRequest & combineFilterExpression(const QString &expression)
Modifies the existing filter expression to add an additional expression filter.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Base class for all map layer types.
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
Represents a vector layer which manages a vector based data sets.