cutelyst  4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
roleacl.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2014-2022 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef ROLEACL_H
6 #define ROLEACL_H
7 
8 #include <Cutelyst/component.h>
9 #include <Cutelyst/componentfactory.h>
10 #include <Cutelyst/context.h>
11 #include <Cutelyst/cutelyst_global.h>
12 
13 #include <QtCore/QVariantHash>
14 
15 namespace Cutelyst {
16 
17 class RoleACLPrivate;
18 class CUTELYST_PLUGIN_ACTION_ROLEACL_EXPORT RoleACL final : public Component
19 {
20  Q_OBJECT
21  Q_DECLARE_PRIVATE(RoleACL)
22 public:
26  explicit RoleACL(QObject *parent = nullptr);
27 
31  Modifiers modifiers() const override;
32 
33  bool init(Application *application, const QVariantHash &args) override;
34 
35  bool aroundExecute(Context *c, QStack<Component *> stack) override;
36 
40  [[nodiscard]] bool canVisit(Context *c) const;
41 
42 protected:
43  virtual bool dispatcherReady(const Dispatcher *dispatcher, Controller *controller) override;
44 };
45 
46 class RoleACLFactory final
47  : public QObject
48  , public ComponentFactory
49 {
50  Q_OBJECT
51  Q_PLUGIN_METADATA(IID "org.cutelyst.ComponentFactory" FILE "metadata.json")
53 public:
54  virtual Component *createComponent(QObject *parent) override { return new RoleACL(parent); }
55 };
56 
57 } // namespace Cutelyst
58 
59 #endif // ROLEACL_H
The Cutelyst Component base class.
Definition: component.h:30
The Cutelyst Context.
Definition: context.h:42
Cutelyst Controller base class.
Definition: controller.h:55
User role-based authorization action role.
Definition: roleacl.h:18
Q_OBJECTQ_OBJECT
The Cutelyst namespace holds all public Cutelyst API.
virtual Component * createComponent(QObject *parent) override
Definition: roleacl.h:54
Q_INTERFACES(...)
The Cutelyst application.
Definition: application.h:72
QObject * parent() const const
The Cutelyst Dispatcher.
Definition: dispatcher.h:28