QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 layerFilterSubsetString 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 }
qgsaccesscontrolfilter.h
QgsAccessControlFilter::QgsAccessControlFilter
QgsAccessControlFilter(const QgsServerInterface *serverInterface)
Constructor QgsServerInterface passed to plugins constructors and must be passed to QgsAccessControlF...
Definition: qgsaccesscontrolfilter.cpp:27
QgsAccessControlFilter::LayerPermissions
Describe the layer permission.
Definition: qgsaccesscontrolfilter.h:65
qgsfeature.h
QgsAccessControlFilter::LayerPermissions::canInsert
bool canInsert
Definition: qgsaccesscontrolfilter.h:69
QgsAccessControlFilter::layerPermissions
virtual LayerPermissions layerPermissions(const QgsMapLayer *layer) const
Returns the layer permissions.
Definition: qgsaccesscontrolfilter.cpp:49
QgsAccessControlFilter::LayerPermissions::canDelete
bool canDelete
Definition: qgsaccesscontrolfilter.h:70
QgsAccessControlFilter::LayerPermissions::canUpdate
bool canUpdate
Definition: qgsaccesscontrolfilter.h:68
QgsAccessControlFilter::allowToEdit
virtual bool allowToEdit(const QgsVectorLayer *layer, const QgsFeature &feature) const
Are we authorized to modify the following geometry.
Definition: qgsaccesscontrolfilter.cpp:67
Qgis::Info
@ Info
Definition: qgis.h:103
QgsAccessControlFilter::cacheKey
virtual QString cacheKey() const
Cache key to used to create the capabilities cache.
Definition: qgsaccesscontrolfilter.cpp:76
QgsAccessControlFilter::layerFilterExpression
virtual QString layerFilterExpression(const QgsVectorLayer *layer) const
Returns an additional expression filter.
Definition: qgsaccesscontrolfilter.cpp:33
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsMapLayer
Definition: qgsmaplayer.h:81
QgsMessageLog::logMessage
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).
Definition: qgsmessagelog.cpp:27
QgsAccessControlFilter::LayerPermissions::canRead
bool canRead
Definition: qgsaccesscontrolfilter.h:67
QgsFeature
Definition: qgsfeature.h:55
QgsAccessControlFilter::layerFilterSubsetString
virtual QString layerFilterSubsetString(const QgsVectorLayer *layer) const
Returns an additional subset string (typically SQL) filter.
Definition: qgsaccesscontrolfilter.cpp:41
QgsServerInterface
Definition: qgsserverinterface.h:60
qgsmessagelog.h
QgsAccessControlFilter::authorizedLayerAttributes
virtual QStringList authorizedLayerAttributes(const QgsVectorLayer *layer, const QStringList &attributes) const
Returns the authorized layer attributes.
Definition: qgsaccesscontrolfilter.cpp:59