QGIS API Documentation  3.6.0-Noosa (5873452)
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::Info );
36  Q_UNUSED( layer );
37  return QString();
38 }
39 
42 {
43  QgsMessageLog::logMessage( QStringLiteral( "QgsAccessControlFilter plugin default layerFilterSQL called" ), QStringLiteral( "AccessControlFilter" ), Qgis::Info );
44  Q_UNUSED( layer );
45  return QString();
46 }
47 
50 {
51  QgsMessageLog::logMessage( QStringLiteral( "QgsAccessControlFilter plugin default layerPermissions called" ), QStringLiteral( "AccessControlFilter" ), Qgis::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::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::Info );
70  Q_UNUSED( layer );
71  Q_UNUSED( feature );
72  return true;
73 }
74 
77 {
78  return QString();
79 }
Base class for all map layer types.
Definition: qgsmaplayer.h:64
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 bool allowToEdit(const QgsVectorLayer *layer, const QgsFeature &feature) const
Are we authorized to modify the following geometry.
virtual QStringList authorizedLayerAttributes(const QgsVectorLayer *layer, const QStringList &attributes) const
Returns the authorized layer attributes.
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).
virtual QString layerFilterExpression(const QgsVectorLayer *layer) const
Returns an additional expression filter.
virtual LayerPermissions layerPermissions(const QgsMapLayer *layer) const
Returns the layer permissions.
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.
Represents a vector layer which manages a vector based data sets.
virtual QString layerFilterSubsetString(const QgsVectorLayer *layer) const
Returns an additional subset string (typically SQL) filter.