ORE Studio 0.0.4
Loading...
Searching...
No Matches
RoleDetailDialog.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_ROLE_DETAIL_DIALOG_HPP
21#define ORES_QT_ROLE_DETAIL_DIALOG_HPP
22
23#include <memory>
24#include "ores.iam.api/domain/role.hpp"
25#include "ores.qt/ClientManager.hpp"
26#include "ores.qt/DetailDialogBase.hpp"
27#include "ores.logging/make_logger.hpp"
28
29namespace Ui {
30
31class RoleDetailDialog;
32
33}
34
35namespace ores::qt {
36
45class RoleDetailDialog final : public DetailDialogBase {
46 Q_OBJECT
47
48private:
49 inline static std::string_view logger_name =
50 "ores.qt.role_detail_dialog";
51
52 [[nodiscard]] static auto& lg() {
53 using namespace ores::logging;
54 static auto instance = make_logger(logger_name);
55 return instance;
56 }
57
58public:
59 explicit RoleDetailDialog(QWidget* parent = nullptr);
60 ~RoleDetailDialog() override;
61
67 void setRole(const iam::domain::role& role);
68
74 [[nodiscard]] const iam::domain::role& getRole() const { return currentRole_; }
75
79 void clearDialog();
80
81signals:
82
83protected:
84 QTabWidget* tabWidget() const override;
85 QWidget* provenanceTab() const override;
86 ProvenanceWidget* provenanceWidget() const override;
87
88private:
89 void populatePermissionsList();
90
91private:
92 std::unique_ptr<Ui::RoleDetailDialog> ui_;
93 iam::domain::role currentRole_;
94};
95
96}
97
98#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Represents a named collection of permissions that can be assigned to accounts.
Definition role.hpp:41
Base class for all detail dialogs.
Definition DetailDialogBase.hpp:74
Widget displaying the 6 standard record provenance fields.
Definition ProvenanceWidget.hpp:39
Dialog widget for viewing role details.
Definition RoleDetailDialog.hpp:45
ProvenanceWidget * provenanceWidget() const override
Returns the promoted ProvenanceWidget (named "provenanceWidget" in .ui).
Definition RoleDetailDialog.cpp:53
QTabWidget * tabWidget() const override
Returns the dialog's QTabWidget (named "tabWidget" in .ui).
Definition RoleDetailDialog.cpp:51
void setRole(const iam::domain::role &role)
Sets the role to display.
Definition RoleDetailDialog.cpp:55
const iam::domain::role & getRole() const
Gets the current role.
Definition RoleDetailDialog.hpp:74
void clearDialog()
Clears all form fields.
Definition RoleDetailDialog.cpp:72
QWidget * provenanceTab() const override
Returns the Provenance tab widget (named "provenanceTab" in .ui).
Definition RoleDetailDialog.cpp:52