Cutelyst  2.13.0
roleacl.h
1 /*
2  * Copyright (C) 2014-2017 Daniel Nicoletti <dantti12@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 #ifndef ROLEACL_H
19 #define ROLEACL_H
20 
21 #include <QtCore/QVariantHash>
22 
23 #include <Cutelyst/cutelyst_global.h>
24 #include <Cutelyst/component.h>
25 #include <Cutelyst/context.h>
26 #include <Cutelyst/componentfactory.h>
27 
28 namespace Cutelyst {
29 
30 class RoleACLPrivate;
31 class CUTELYST_PLUGIN_ACTION_ROLEACL_EXPORT RoleACL final : public Component
32 {
33  Q_OBJECT
34  Q_DECLARE_PRIVATE(RoleACL)
35 public:
39  explicit RoleACL(QObject *parent = nullptr);
40 
44  virtual Modifiers modifiers() const override;
45 
49  virtual bool init(Application *application, const QVariantHash &args) override;
50 
54  virtual bool aroundExecute(Context *c, QStack<Component *> stack) override;
55 
59  bool canVisit(Context *c) const;
60 
61 protected:
65  virtual bool dispatcherReady(const Dispatcher *dispatcher, Controller *controller) override;
66 };
67 
68 class RoleACLFactory final : public QObject, public ComponentFactory
69 {
70  Q_OBJECT
71  Q_PLUGIN_METADATA(IID "org.cutelyst.ComponentFactory" FILE "metadata.json")
72  Q_INTERFACES(Cutelyst::ComponentFactory)
73 public:
74  virtual Component *createComponent(QObject *parent) override { return new RoleACL(parent); }
75 };
76 
77 
78 }
79 
80 #endif // ROLEACL_H
Cutelyst::RoleACLFactory
Definition: roleacl.h:68
Cutelyst::Controller
Cutelyst Controller base class
Definition: controller.h:102
Cutelyst::ComponentFactory
Definition: componentfactory.h:26
Cutelyst::Application
The Cutelyst Application.
Definition: application.h:55
Cutelyst::Dispatcher
The Cutelyst Dispatcher.
Definition: dispatcher.h:40
Cutelyst::Context
The Cutelyst Context.
Definition: context.h:50
Cutelyst::Component
The Cutelyst Component base class.
Definition: component.h:38
Cutelyst::RoleACLFactory::createComponent
virtual Component * createComponent(QObject *parent) override
Definition: roleacl.h:74
Cutelyst
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
Cutelyst::RoleACL
User role-based authorization action class.
Definition: roleacl.h:31