QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 #include <QString>
26 #include <QStringList>
27 
28 
31  mServerInterface( serverInterface )
32 {
33 }
34 
37 {
38  QgsMessageLog::logMessage( QStringLiteral( "QgsAccessControlFilter plugin default layerFilterExpression called" ), QStringLiteral( "AccessControlFilter" ), Qgis::Info );
39  Q_UNUSED( layer );
40  return QString();
41 }
42 
45 {
46  QgsMessageLog::logMessage( QStringLiteral( "QgsAccessControlFilter plugin default layerFilterSQL called" ), QStringLiteral( "AccessControlFilter" ), Qgis::Info );
47  Q_UNUSED( layer );
48  return QString();
49 }
50 
53 {
54  QgsMessageLog::logMessage( QStringLiteral( "QgsAccessControlFilter plugin default layerPermissions called" ), QStringLiteral( "AccessControlFilter" ), Qgis::Info );
55  Q_UNUSED( layer );
57  permissions.canRead = permissions.canUpdate = permissions.canInsert = permissions.canDelete = true;
58  return permissions;
59 }
60 
62 QStringList QgsAccessControlFilter::authorizedLayerAttributes( const QgsVectorLayer *layer, const QStringList &attributes ) const
63 {
64  Q_UNUSED( layer );
65  QgsMessageLog::logMessage( QStringLiteral( "QgsAccessControlFilter plugin default authorizedLayerAttributes called" ), QStringLiteral( "AccessControlFilter" ), Qgis::Info );
66  return attributes;
67 }
68 
70 bool QgsAccessControlFilter::allowToEdit( const QgsVectorLayer *layer, const QgsFeature &feature ) const
71 {
72  QgsMessageLog::logMessage( QStringLiteral( "QgsAccessControlFilter plugin default allowToEdit called" ), QStringLiteral( "AccessControlFilter" ), Qgis::Info );
73  Q_UNUSED( layer );
74  Q_UNUSED( feature );
75  return true;
76 }
77 
80 {
81  return QString();
82 }
Base class for all map layer types.
Definition: qgsmaplayer.h:63
virtual QString layerFilterExpression(const QgsVectorLayer *layer) const
Returns an additional expression filter.
QgsAccessControlFilter(const QgsServerInterface *serverInterface)
Constructor QgsServerInterface passed to plugins constructors and must be passed to QgsAccessControlF...
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:55
virtual QString layerFilterSubsetString(const QgsVectorLayer *layer) const
Returns an additional subset string (typically SQL) filter.
virtual bool allowToEdit(const QgsVectorLayer *layer, const QgsFeature &feature) const
Are we authorized to modify the following geometry.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::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...
virtual QString cacheKey() const
Cache key to used to create the capabilities cache.
virtual LayerPermissions layerPermissions(const QgsMapLayer *layer) const
Returns the layer permissions.
virtual QStringList authorizedLayerAttributes(const QgsVectorLayer *layer, const QStringList &attributes) const
Returns the authorized layer attributes.
Represents a vector layer which manages a vector based data sets.