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( QStringLiteral(
") AND (" ) ) ).append(
"))" );
67 if ( mResolved && mFilterFeaturesExpressions.keys().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( QStringLiteral(
") 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.length() == 0 )
206 mPluginsAccessControls->insert( priority, accessControl );
bool layerInsertPermission(const QgsVectorLayer *layer) const
Returns the layer insert right.
bool fillCacheKey(QStringList &cacheKey) const
Fill the capabilities caching key.
void resolveFilterFeatures(const QList< QgsMapLayer *> &layers)
Resolve features' filter of layers.
Base class for all map layer types.
QString extraSubsetString(const QgsVectorLayer *layer) const
Returns an additional subset string (typically SQL) filter.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
bool layerDeletePermission(const QgsVectorLayer *layer) const
Returns the layer delete right.
Class defining access control interface for QGIS Server plugins.
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Abstract interface for use by classes that filter the features of a layer.
QgsFeatureFilterProvider * clone() const override
Returns a clone of the object.
QgsAccessControl()
Constructor.
bool layerReadPermission(const QgsMapLayer *layer) const
Returns the layer read right.
void filterFeatures(const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures) const override
Filter the features of the layer.
bool layerUpdatePermission(const QgsVectorLayer *layer) const
Returns the layer update right.
void registerAccessControl(QgsAccessControlFilter *accessControl, int priority=0)
Register an access control filter.
Represents a vector layer which manages a vector based data sets.
QStringList layerAttributes(const QgsVectorLayer *layer, const QStringList &attributes) const
Returns the authorized layer attributes.
bool allowToEdit(const QgsVectorLayer *layer, const QgsFeature &feature) const
Are we authorized to modify the following geometry.