Class: QgsAccessControl

A helper class that centralizes restrictions given by all the access control filter plugins.

Class Hierarchy

Inheritance diagram of qgis.server.QgsAccessControl

Base classes

QgsFeatureFilterProvider

Abstract interface for use by classes that filter the features or attributes of a layer.

Abstract Methods

clone

Returns a clone of the object

filterFeatures

Filter the features of the layer

layerAttributes

Returns the authorized layer attributes

Methods

allowToEdit

Are we authorized to modify the following geometry

extraSubsetString

Returns an additional subset string (typically SQL) filter

fillCacheKey

Fill the capabilities caching key

layerDeletePermission

Returns the layer delete right

layerInsertPermission

Returns the layer insert right

layerReadPermission

Returns the layer read right

layerUpdatePermission

Returns the layer update right

registerAccessControl

Register an access control filter

resolveFilterFeatures

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.

unresolveFilterFeatures

Clear expression's cache computed from resolveFilterFeatures

class qgis.server.QgsAccessControl[source]

Bases: QgsFeatureFilterProvider

__init__()

Constructor

__init__(copy: QgsAccessControl)
Parameters:

copy (QgsAccessControl)

allowToEdit(self, layer: QgsVectorLayer | None, feature: QgsFeature) bool[source]

Are we authorized to modify the following geometry

Parameters:
Return type:

bool

Returns:

True if we are allowed to edit the feature

abstract clone(self) QgsFeatureFilterProvider | None[source]

Returns a clone of the object

Return type:

Optional[QgsFeatureFilterProvider]

Returns:

A clone

extraSubsetString(self, layer: QgsVectorLayer | None) str[source]

Returns an additional subset string (typically SQL) filter

Parameters:

layer (Optional[QgsVectorLayer]) – the layer to control

Return type:

str

Returns:

the subset string to use

fillCacheKey(self, cacheKey: Iterable[str | None]) bool[source]

Fill the capabilities caching key

Parameters:

cacheKey (Iterable[Optional[str]]) – the list to fill with a cache variant

Return type:

bool

abstract filterFeatures(self, layer: QgsVectorLayer | None, filterFeatures: QgsFeatureRequest)[source]

Filter the features of the layer

Parameters:
abstract layerAttributes(self, layer: QgsVectorLayer | None, attributes: Iterable[str | None]) List[str][source]

Returns the authorized layer attributes

Parameters:
  • layer (Optional[QgsVectorLayer]) – the layer to control

  • attributes (Iterable[Optional[str]]) – the list of attribute

Return type:

List[str]

Returns:

the list of visible attributes

layerDeletePermission(self, layer: QgsVectorLayer | None) bool[source]

Returns the layer delete right

Parameters:

layer (Optional[QgsVectorLayer]) – the layer to control

Return type:

bool

Returns:

True if we can do a delete

layerInsertPermission(self, layer: QgsVectorLayer | None) bool[source]

Returns the layer insert right

Parameters:

layer (Optional[QgsVectorLayer]) – the layer to control

Return type:

bool

Returns:

True if we can insert on it

layerReadPermission(self, layer: QgsMapLayer | None) bool[source]

Returns the layer read right

Parameters:

layer (Optional[QgsMapLayer]) – the layer to control

Return type:

bool

Returns:

True if it can be read

layerUpdatePermission(self, layer: QgsVectorLayer | None) bool[source]

Returns the layer update right

Parameters:

layer (Optional[QgsVectorLayer]) – the layer to control

Return type:

bool

Returns:

True if we can do an update

registerAccessControl(self, accessControl: QgsAccessControlFilter | None, priority: int = 0)[source]

Register an access control filter

Parameters:
  • accessControl (Optional[QgsAccessControlFilter]) – the access control to add

  • priority (int = 0) – the priority used to define the order

resolveFilterFeatures(self, layers: Iterable[QgsMapLayer])[source]

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)[source]

Clear expression’s cache computed from resolveFilterFeatures