QGIS API Documentation 3.99.0-Master (a26b91b364d)
|
A helper class that centralizes restrictions given by all the access control filter plugins. More...
#include <qgsaccesscontrol.h>
Public Member Functions | |
QgsAccessControl () | |
Constructor. | |
QgsAccessControl (const QgsAccessControl ©) | |
~QgsAccessControl () override | |
bool | allowToEdit (const QgsVectorLayer *layer, const QgsFeature &feature) const |
Are we authorized to modify the following geometry. | |
QgsAccessControl * | clone () const override |
Clone the object. | |
QString | extraSubsetString (const QgsVectorLayer *layer) const |
Returns an additional subset string (typically SQL) filter. | |
bool | fillCacheKey (QStringList &cacheKey) const |
Fill the capabilities caching key. | |
void | filterFeatures (const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures) const override |
Filter the features of the layer. | |
bool | isFilterThreadSafe () const override |
Returns true if the filterFeature function is thread safe, which will lead to reliance on layer ID instead of the raw layer pointer. | |
QStringList | layerAttributes (const QgsVectorLayer *layer, const QStringList &attributes) const override |
Returns the authorized layer attributes. | |
bool | layerDeletePermission (const QgsVectorLayer *layer) const |
Returns the layer delete right. | |
bool | layerInsertPermission (const QgsVectorLayer *layer) const |
Returns the layer insert right. | |
bool | layerReadPermission (const QgsMapLayer *layer) const |
Returns the layer read right. | |
bool | layerUpdatePermission (const QgsVectorLayer *layer) const |
Returns the layer update right. | |
QgsAccessControl & | operator= (const QgsAccessControl &other) |
void | registerAccessControl (QgsAccessControlFilter *accessControl, int priority=0) |
Register an access control filter. | |
void | resolveFilterFeatures (const QList< QgsMapLayer * > &layers) |
Resolve features' filter of layers The method fetch filter's expressions returned from access control plugins and and combine them to a unique expression for each layer. | |
void | unresolveFilterFeatures () |
Clear expression's cache computed from resolveFilterFeatures | |
![]() | |
QgsFeatureFilterProvider ()=default | |
virtual | ~QgsFeatureFilterProvider ()=default |
virtual void | filterFeatures (const QString &layerId, QgsFeatureRequest &featureRequest) const |
Add additional filters to the feature request to further restrict the features returned by the request. | |
A helper class that centralizes restrictions given by all the access control filter plugins.
Definition at line 35 of file qgsaccesscontrol.h.
|
inline |
Constructor.
Definition at line 43 of file qgsaccesscontrol.h.
|
inline |
Definition at line 49 of file qgsaccesscontrol.h.
|
inlineoverride |
Definition at line 57 of file qgsaccesscontrol.h.
bool QgsAccessControl::allowToEdit | ( | const QgsVectorLayer * | layer, |
const QgsFeature & | feature | ||
) | const |
Are we authorized to modify the following geometry.
layer | the layer to control |
feature | the concerned feature |
true
if we are allowed to edit the feature Definition at line 179 of file qgsaccesscontrol.cpp.
|
overridevirtual |
Clone the object.
Implements QgsFeatureFilterProvider.
Definition at line 89 of file qgsaccesscontrol.cpp.
QString QgsAccessControl::extraSubsetString | ( | const QgsVectorLayer * | layer | ) | const |
Returns an additional subset string (typically SQL) filter.
layer | the layer to control |
Definition at line 95 of file qgsaccesscontrol.cpp.
bool QgsAccessControl::fillCacheKey | ( | QStringList & | cacheKey | ) | const |
Fill the capabilities caching key.
cacheKey | the list to fill with a cache variant |
Definition at line 193 of file qgsaccesscontrol.cpp.
|
overridevirtual |
Filter the features of the layer.
Reimplemented from QgsFeatureFilterProvider.
Definition at line 69 of file qgsaccesscontrol.cpp.
|
inlineoverridevirtual |
Returns true
if the filterFeature function is thread safe, which will lead to reliance on layer ID instead of the raw layer pointer.
Reimplemented from QgsFeatureFilterProvider.
Definition at line 74 of file qgsaccesscontrol.h.
|
overridevirtual |
Returns the authorized layer attributes.
Implements QgsFeatureFilterProvider.
Definition at line 167 of file qgsaccesscontrol.cpp.
bool QgsAccessControl::layerDeletePermission | ( | const QgsVectorLayer * | layer | ) | const |
Returns the layer delete right.
layer | the layer to control |
true
if we can do a delete Definition at line 153 of file qgsaccesscontrol.cpp.
bool QgsAccessControl::layerInsertPermission | ( | const QgsVectorLayer * | layer | ) | const |
Returns the layer insert right.
layer | the layer to control |
true
if we can insert on it Definition at line 125 of file qgsaccesscontrol.cpp.
bool QgsAccessControl::layerReadPermission | ( | const QgsMapLayer * | layer | ) | const |
Returns the layer read right.
layer | the layer to control |
true
if it can be read Definition at line 111 of file qgsaccesscontrol.cpp.
bool QgsAccessControl::layerUpdatePermission | ( | const QgsVectorLayer * | layer | ) | const |
Returns the layer update right.
layer | the layer to control |
true
if we can do an update Definition at line 139 of file qgsaccesscontrol.cpp.
|
inline |
Definition at line 62 of file qgsaccesscontrol.h.
void QgsAccessControl::registerAccessControl | ( | QgsAccessControlFilter * | accessControl, |
int | priority = 0 |
||
) |
Register an access control filter.
Register a new access control filter.
accessControl | the access control to add |
priority | the priority used to define the order |
Definition at line 209 of file qgsaccesscontrol.cpp.
void QgsAccessControl::resolveFilterFeatures | ( | const QList< QgsMapLayer * > & | layers | ) |
Resolve features' filter of layers The method fetch filter's expressions returned from access control plugins and and combine them to a unique expression for each layer.
The resulted expressions are stored in cache for efficiency; between each requests, the cache must be cleared using 'unresolveFilterFeatures()'.
layers | to filter |
Definition at line 24 of file qgsaccesscontrol.cpp.
void QgsAccessControl::unresolveFilterFeatures | ( | ) |
Clear expression's cache computed from resolveFilterFeatures
Clear feature's filter of layers.
Definition at line 62 of file qgsaccesscontrol.cpp.