Class: QgsAccessControl¶
- class qgis.server.QgsAccessControl¶
Bases:
QgsFeatureFilterProvider
A helper class that centralizes restrictions given by all the access control filter plugins.
New in version 2.14.
QgsAccessControl() Constructor
QgsAccessControl(copy:
QgsAccessControl
) ConstructorMethods
Are we authorized to modify the following geometry
Returns a clone of the object
Returns an additional subset string (typically SQL) filter
Fill the capabilities caching key
Filter the features of the layer
Returns the authorized layer attributes
Returns the layer delete right
Returns the layer insert right
Returns the layer read right
Returns the layer update right
Register an access control filter
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.
Clear expression's cache computed from resolveFilterFeatures
- allowToEdit(self, layer: QgsVectorLayer, feature: QgsFeature) bool ¶
Are we authorized to modify the following geometry
- Parameters:
layer (QgsVectorLayer) – the layer to control
feature (QgsFeature) – the concerned feature
- Return type:
bool
- Returns:
True
if we are allowed to edit the feature
- clone(self) QgsFeatureFilterProvider ¶
Returns a clone of the object
- Return type:
- Returns:
A clone
- extraSubsetString(self, layer: QgsVectorLayer) str ¶
Returns an additional subset string (typically SQL) filter
- Parameters:
layer (QgsVectorLayer) – the layer to control
- Return type:
str
- Returns:
the subset string to use
- fillCacheKey(self, cacheKey: Iterable[str]) bool ¶
Fill the capabilities caching key
- Parameters:
cacheKey (Iterable[str]) – the list to fill with a cache variant
- Return type:
bool
- filterFeatures(self, layer: QgsVectorLayer, filterFeatures: QgsFeatureRequest)¶
Filter the features of the layer
- Parameters:
layer (QgsVectorLayer) – the layer to control
filterFeatures (QgsFeatureRequest) – the request to fill
- layerAttributes(self, layer: QgsVectorLayer, attributes: Iterable[str]) List[str] ¶
Returns the authorized layer attributes
- Parameters:
layer (QgsVectorLayer) – the layer to control
attributes (Iterable[str]) – the list of attribute
- Return type:
List[str]
- Returns:
the list of visible attributes
- layerDeletePermission(self, layer: QgsVectorLayer) bool ¶
Returns the layer delete right
- Parameters:
layer (QgsVectorLayer) – the layer to control
- Return type:
bool
- Returns:
True
if we can do a delete
- layerInsertPermission(self, layer: QgsVectorLayer) bool ¶
Returns the layer insert right
- Parameters:
layer (QgsVectorLayer) – the layer to control
- Return type:
bool
- Returns:
True
if we can insert on it
- layerReadPermission(self, layer: QgsMapLayer) bool ¶
Returns the layer read right
- Parameters:
layer (QgsMapLayer) – the layer to control
- Return type:
bool
- Returns:
True
if it can be read
- layerUpdatePermission(self, layer: QgsVectorLayer) bool ¶
Returns the layer update right
- Parameters:
layer (QgsVectorLayer) – the layer to control
- Return type:
bool
- Returns:
True
if we can do an update
- registerAccessControl(self, accessControl: QgsAccessControlFilter, priority: int = 0)¶
Register an access control filter
- Parameters:
accessControl (QgsAccessControlFilter) – the access control to add
priority (int = 0) – the priority used to define the order
- resolveFilterFeatures(self, layers: Iterable[QgsMapLayer])¶
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()
’.- Parameters:
layers (Iterable[QgsMapLayer]) – to filter
- unresolveFilterFeatures(self)¶
Clear expression’s cache computed from resolveFilterFeatures