cutelyst  4.5.1
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 
12 #include <QtCore/QVariantHash>
13 
14 namespace Cutelyst {
15 
16 class RoleACLPrivate;
17 class RoleACL final : public Component
18 {
19  Q_OBJECT
20  Q_DECLARE_PRIVATE(RoleACL)
21 public:
25  explicit RoleACL(QObject *parent = nullptr);
26 
30  Modifiers modifiers() const override;
31 
32  bool init(Application *application, const QVariantHash &args) override;
33 
34  bool aroundExecute(Context *c, QStack<Component *> stack) override;
35 
39  [[nodiscard]] bool canVisit(Context *c) const;
40 
41 protected:
42  bool dispatcherReady(const Dispatcher *dispatcher, Controller *controller) override;
43 };
44 
45 class CutelystRoleACL final
46  : public QObject
47  , public ComponentFactory
48 {
49  Q_OBJECT
50  Q_PLUGIN_METADATA(IID "org.cutelyst.ComponentFactory" FILE "metadata.json")
52 public:
53  Component *createComponent(QObject *parent) override { return new RoleACL(parent); }
54 };
55 
56 } // namespace Cutelyst
57 
58 #endif // ROLEACL_H
The Cutelyst application.
Definition: application.h:66
The Cutelyst Component base class.
Definition: component.h:30
The Cutelyst Context.
Definition: context.h:42
Cutelyst Controller base class.
Definition: controller.h:56
Component * createComponent(QObject *parent) override
Definition: roleacl.h:53
The Cutelyst Dispatcher.
Definition: dispatcher.h:29
User role-based authorization action role.
Definition: roleacl.h:18
bool canVisit(Context *c) const
Definition: roleacl.cpp:180
bool init(Application *application, const QVariantHash &args) override
Definition: roleacl.cpp:133
RoleACL(QObject *parent=nullptr)
Definition: roleacl.cpp:123
bool aroundExecute(Context *c, QStack< Component * > stack) override
Definition: roleacl.cpp:167
Modifiers modifiers() const override
Definition: roleacl.cpp:128
bool dispatcherReady(const Dispatcher *dispatcher, Controller *controller) override
Definition: roleacl.cpp:220
The Cutelyst namespace holds all public Cutelyst API.
Q_INTERFACES(...)
Q_OBJECTQ_OBJECT
QObject * parent() const const