QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsaccesscontrolfilter.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsaccesscontrolplugin.cpp
3  --------------------------
4  Access control interface for QGIS Server plugins
5 
6  begin : 2015-05-19
7  copyright : (C) 2015 by Stéphane Brunner
8  email : stephane dot brunner at camptocamp dot org
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
20 
21 #include "qgsaccesscontrolfilter.h"
22 #include "qgsmessagelog.h"
23 #include "qgsfeature.h"
24 
25 
28  mServerInterface( serverInterface )
29 {
30 }
31 
34 {
35  QgsMessageLog::logMessage( QStringLiteral( "QgsAccessControlFilter plugin default layerFilterExpression called" ), QStringLiteral( "AccessControlFilter" ), Qgis::MessageLevel::Info );
36  Q_UNUSED( layer )
37  return QString();
38 }
39 
42 {
43  QgsMessageLog::logMessage( QStringLiteral( "QgsAccessControlFilter plugin default layerFilterSubsetString called" ), QStringLiteral( "AccessControlFilter" ), Qgis::MessageLevel::Info );
44  Q_UNUSED( layer )
45  return QString();
46 }
47 
50 {
51  QgsMessageLog::logMessage( QStringLiteral( "QgsAccessControlFilter plugin default layerPermissions called" ), QStringLiteral( "AccessControlFilter" ), Qgis::MessageLevel::Info );
52  Q_UNUSED( layer )
54  permissions.canRead = permissions.canUpdate = permissions.canInsert = permissions.canDelete = true;
55  return permissions;
56 }
57 
59 QStringList QgsAccessControlFilter::authorizedLayerAttributes( const QgsVectorLayer *layer, const QStringList &attributes ) const
60 {
61  Q_UNUSED( layer )
62  QgsMessageLog::logMessage( QStringLiteral( "QgsAccessControlFilter plugin default authorizedLayerAttributes called" ), QStringLiteral( "AccessControlFilter" ), Qgis::MessageLevel::Info );
63  return attributes;
64 }
65 
67 bool QgsAccessControlFilter::allowToEdit( const QgsVectorLayer *layer, const QgsFeature &feature ) const
68 {
69  QgsMessageLog::logMessage( QStringLiteral( "QgsAccessControlFilter plugin default allowToEdit called" ), QStringLiteral( "AccessControlFilter" ), Qgis::MessageLevel::Info );
70  Q_UNUSED( layer )
71  Q_UNUSED( feature )
72  return true;
73 }
74 
77 {
78  return QString();
79 }
virtual LayerPermissions layerPermissions(const QgsMapLayer *layer) const
Returns the layer permissions.
QgsAccessControlFilter(const QgsServerInterface *serverInterface)
Constructor QgsServerInterface passed to plugins constructors and must be passed to QgsAccessControlF...
virtual QStringList authorizedLayerAttributes(const QgsVectorLayer *layer, const QStringList &attributes) const
Returns the authorized layer attributes.
virtual QString cacheKey() const
Cache key to used to create the capabilities cache.
virtual QString layerFilterExpression(const QgsVectorLayer *layer) const
Returns an additional expression filter.
virtual bool allowToEdit(const QgsVectorLayer *layer, const QgsFeature &feature) const
Are we authorized to modify the following geometry.
virtual QString layerFilterSubsetString(const QgsVectorLayer *layer) const
Returns an additional subset string (typically SQL) filter.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:56
Base class for all map layer types.
Definition: qgsmaplayer.h:70
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins.
Represents a vector layer which manages a vector based data sets.