Cutelyst  3.5.0
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 <QtCore/QVariantHash>
9 
10 #include <Cutelyst/cutelyst_global.h>
11 #include <Cutelyst/component.h>
12 #include <Cutelyst/context.h>
13 #include <Cutelyst/componentfactory.h>
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  virtual Modifiers modifiers() const override;
32 
36  virtual bool init(Application *application, const QVariantHash &args) override;
37 
41  virtual bool aroundExecute(Context *c, QStack<Component *> stack) override;
42 
46  bool canVisit(Context *c) const;
47 
48 protected:
52  virtual bool dispatcherReady(const Dispatcher *dispatcher, Controller *controller) override;
53 };
54 
55 class RoleACLFactory final : public QObject, public ComponentFactory
56 {
57  Q_OBJECT
58  Q_PLUGIN_METADATA(IID "org.cutelyst.ComponentFactory" FILE "metadata.json")
59  Q_INTERFACES(Cutelyst::ComponentFactory)
60 public:
61  virtual Component *createComponent(QObject *parent) override { return new RoleACL(parent); }
62 };
63 
64 
65 }
66 
67 #endif // ROLEACL_H
The Cutelyst Component base class.
Definition: component.h:25
The Cutelyst Context.
Definition: context.h:38
Cutelyst Controller base class
Definition: controller.h:89
User role-based authorization action class.
Definition: roleacl.h:18
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
virtual Component * createComponent(QObject *parent) override
Definition: roleacl.h:61
The Cutelyst Application.
Definition: application.h:42
QObject * parent() const const
The Cutelyst Dispatcher.
Definition: dispatcher.h:27