QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsfilterrestorer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfilterrestorer.h
3  --------------
4  begin : March 24, 2014
5  copyright : (C) 2006 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSFILTERRESTORER_H
19 #define QGSFILTERRESTORER_H
20 
21 #define SIP_NO_FILE
22 
23 
24 #include "qgis_server.h"
25 
26 #include <QHash>
27 
28 class QgsMapLayer;
29 class QgsAccessControl;
30 
36 class SERVER_EXPORT QgsOWSServerFilterRestorer
37 {
38  public:
39 
44 
47  {
48  restoreLayerFilters( mOriginalLayerFilters );
49  }
50 
55 
56  void restoreLayerFilters( const QHash<QgsMapLayer *, QString> &filterMap );
57 
62  QHash<QgsMapLayer *, QString> &originalFilters() { return mOriginalLayerFilters; }
63 
65  //XXX May be this method should be owned QgsAccessControl
66  static void applyAccessControlLayerFilters( const QgsAccessControl *accessControl, QgsMapLayer *mapLayer,
67  QHash<QgsMapLayer *, QString> &originalLayerFilters );
68 
75  static void applyAccessControlLayerFilters( const QgsAccessControl *accessControl, QgsMapLayer *mapLayer );
76 
77  private:
78  QHash<QgsMapLayer *, QString> mOriginalLayerFilters;
79 
80 };
81 
82 #endif // QGSFILTERRESTORER_H
83 
QgsOWSServerFilterRestorer::originalFilters
QHash< QgsMapLayer *, QString > & originalFilters()
Returns a reference to the object's hash of layers to original subsetString filters.
Definition: qgsfilterrestorer.h:62
QgsOWSServerFilterRestorer::~QgsOWSServerFilterRestorer
~QgsOWSServerFilterRestorer()
Destructor. When object is destroyed all original layer filters will be restored.
Definition: qgsfilterrestorer.h:46
QgsOWSServerFilterRestorer
RAII class to restore layer filters on destruction.
Definition: qgsfilterrestorer.h:37
QgsOWSServerFilterRestorer::operator=
QgsOWSServerFilterRestorer & operator=(const QgsOWSServerFilterRestorer &rh)=delete
QgsOWSServerFilterRestorer cannot be copied.
QgsOWSServerFilterRestorer::applyAccessControlLayerFilters
static void applyAccessControlLayerFilters(const QgsAccessControl *accessControl, QgsMapLayer *mapLayer)
Applies filters from access control on layer.
QgsOWSServerFilterRestorer::applyAccessControlLayerFilters
static void applyAccessControlLayerFilters(const QgsAccessControl *accessControl, QgsMapLayer *mapLayer, QHash< QgsMapLayer *, QString > &originalLayerFilters)
Apply filter from AccessControl.
QgsOWSServerFilterRestorer::QgsOWSServerFilterRestorer
QgsOWSServerFilterRestorer(const QgsOWSServerFilterRestorer &rh)=delete
QgsOWSServerFilterRestorer cannot be copied.
QgsAccessControl
A helper class that centralizes restrictions given by all the access control filter plugins.
Definition: qgsaccesscontrol.h:37
QgsOWSServerFilterRestorer::QgsOWSServerFilterRestorer
QgsOWSServerFilterRestorer()=default
Default constructor for QgsOWSServerFilterRestorer.
QgsMapLayer
Base class for all map layer types.
Definition: qgsmaplayer.h:83