1#ifndef IV_SRC_DIAMAR_SETTINGS_HPP_
2#define IV_SRC_DIAMAR_SETTINGS_HPP_
6#include "model/enums.hpp"
7#include "model/structs.hpp"
8#include "third_party/magic_enum/magic_enum.hpp"
19 static bool validatePassword(
const std::string_view &password, std::string *errorMsg);
22 std::map<iv::diamar::eUserProfileType, std::shared_ptr<iv::diamar::UserProfile>>
profiles;
76 std::shared_ptr<iv::diamar::UserProfile> userProfile = std::make_shared<iv::diamar::UserProfile>();
77 result &= userProfile->load(nodeProfile);
78 profiles.insert_or_assign(userProfile->getType(), userProfile);
81 for (
const auto &profileType: magic_enum::enum_values<iv::diamar::eUserProfileType>())
83 if (not
profiles.contains(profileType))
124 for (
const auto &[profileType, userProfile]:
profiles)
127 result &= userProfile->save(nodeProfile);
147 for (
const auto &[profileType, userProfile]: other.
profiles)
149 if (not
profiles.contains(profileType))
151 profiles.insert_or_assign(profileType, userProfile);
155 profiles.at(profileType)->update(*userProfile);
159 std::erase_if(
profiles, [&other](
const auto &profile) {
return not other.
profiles.contains(profile.first); });
175 profiles.insert_or_assign(engMgt->getType(), engMgt);
176 profiles.insert_or_assign(advEngMgt->getType(), advEngMgt);
177 profiles.insert_or_assign(root->getType(), root);
178 profiles.insert_or_assign(deckMgt->getType(), deckMgt);
179 profiles.insert_or_assign(advDeckMgt->getType(), advDeckMgt);
180 profiles.insert_or_assign(monitor->getType(), monitor);
186 static constexpr std::string_view
general {
"General"};
187 static constexpr std::string_view
profiles {
"Profiles"};
188 static constexpr std::string_view
profile {
"Profile"};
205 static constexpr std::string_view
maxLogs {
"MaxNumberLogs"};
Definition xmlFile.hpp:15
T getAttribute(const std::string_view key, T defaultValue) const
Definition xmlFile.hpp:33
iv::file::xml::node getChild(std::string_view name) const
Definition xmlFile.cpp:43
bool addAttribute(const std::string_view key, T value)
Definition xmlFile.hpp:77
bool emptyNode() const
Definition xmlFile.cpp:18
iv::file::xml::node appendChild(std::string_view name)
Definition xmlFile.cpp:53
Definition DataLoggerManager.cpp:10
@ EngineAdvancedManagement
Definition Settings.hpp:209
static constexpr bool enableTrendCurves
Definition Settings.hpp:213
static constexpr bool showShipyardTag
Definition Settings.hpp:216
static constexpr bool enableChannelLogs
Definition Settings.hpp:214
static constexpr uint64_t maxLogs
Definition Settings.hpp:217
static constexpr bool includeDiamar1Functionalities
Definition Settings.hpp:218
static constexpr bool enablePasswordConstraints
Definition Settings.hpp:210
static constexpr bool isDemoMode
Definition Settings.hpp:215
static constexpr std::string defaultPrinter
Definition Settings.hpp:211
static constexpr bool allowRemoteConnection
Definition Settings.hpp:212
Definition Settings.hpp:197
static constexpr std::string_view showShipyardTag
Definition Settings.hpp:204
static constexpr std::string_view printerDevice
Definition Settings.hpp:199
static constexpr std::string_view includeDiamar1Functionalities
Definition Settings.hpp:206
static constexpr std::string_view enableChannelLogs
Definition Settings.hpp:202
static constexpr std::string_view allowRemoteConnection
Definition Settings.hpp:200
static constexpr std::string_view enablePasswordConstraints
Definition Settings.hpp:198
static constexpr std::string_view maxLogs
Definition Settings.hpp:205
static constexpr std::string_view isDemoMode
Definition Settings.hpp:203
static constexpr std::string_view enableTrendCurves
Definition Settings.hpp:201
Definition Settings.hpp:185
static constexpr std::string_view general
Definition Settings.hpp:186
static constexpr std::string_view loginLockout
Definition Settings.hpp:191
static constexpr std::string_view passwordRequirements
Definition Settings.hpp:189
static constexpr std::string_view passwordLifecycle
Definition Settings.hpp:190
static constexpr std::string_view profile
Definition Settings.hpp:188
static constexpr std::string_view timeSyncSettings
Definition Settings.hpp:193
static constexpr std::string_view cloudSettings
Definition Settings.hpp:192
static constexpr std::string_view deadManSettings
Definition Settings.hpp:194
static constexpr std::string_view profiles
Definition Settings.hpp:187
Definition Settings.hpp:17
bool enableTrendCurves
Definition Settings.hpp:34
iv::model::DeadManSettings deadManSettings
Definition Settings.hpp:29
void innitDefaultProfiles()
Definition Settings.hpp:162
std::map< iv::diamar::eUserProfileType, std::shared_ptr< iv::diamar::UserProfile > > profiles
Definition Settings.hpp:22
bool save(iv::file::xml::node &nodeConfigDiamar) const
Definition Settings.hpp:92
std::vector< std::shared_ptr< iv::diamar::UserProfile > > getUsersWithPermissions()
Definition Settings.cpp:103
bool includeDiamar1Functionalities
Definition Settings.hpp:39
bool isDemoMode
Definition Settings.hpp:36
bool enablePasswordConstraints
Definition Settings.hpp:23
iv::model::LoginLockout loginLockout
Definition Settings.hpp:26
bool allowRemoteConnection
Definition Settings.hpp:33
iv::model::TimeSyncSettings timeSyncSettings
Definition Settings.hpp:28
bool showShipyardTag
Definition Settings.hpp:37
uint64_t maxLogs
Definition Settings.hpp:38
static bool validatePassword(const std::string_view &password, std::string *errorMsg)
Definition Settings.cpp:22
static void actionUnsuccessfulLoginSettingsChanged()
Definition Settings.cpp:162
iv::model::PasswordRequirements passwordRequirements
Definition Settings.hpp:24
static void actionUserPasswordChanged()
bool enableChannelLogs
Definition Settings.hpp:35
static void actionPasswordLifecycleChanged()
Definition Settings.cpp:143
bool load(const iv::file::xml::node &nodeConfigDiamar)
Definition Settings.hpp:46
iv::model::PasswordLifecycle passwordLifecycle
Definition Settings.hpp:25
Settings()
Definition Settings.cpp:10
static void actionPasswordRequirementsChanged()
Definition Settings.cpp:124
void update(const Settings &other)
Definition Settings.hpp:133
std::string printerDevice
Definition Settings.hpp:31
iv::model::CloudSettings cloudSettings
Definition Settings.hpp:27
Definition structs.hpp:168
bool save(iv::file::xml::node &nodeCloudSettings) const
Definition structs.cpp:395
bool load(const iv::file::xml::node &nodeCloudSettings)
Definition structs.cpp:381
Definition structs.hpp:358
bool save(iv::file::xml::node &nodeDeadManSettings) const
Definition structs.cpp:824
bool load(const iv::file::xml::node &nodeDeadManSettings)
Definition structs.cpp:798
Definition structs.hpp:134
bool load(const iv::file::xml::node &nodeLoginLockout)
Definition structs.cpp:315
bool save(iv::file::xml::node &nodeLoginLockout) const
Definition structs.cpp:324
Definition structs.hpp:99
bool save(iv::file::xml::node &nodePasswordLifecycle) const
Definition structs.cpp:261
bool load(const iv::file::xml::node &nodePasswordLifecycle)
Definition structs.cpp:250
Definition structs.hpp:62
bool save(iv::file::xml::node &nodePasswordRequirements) const
Definition structs.cpp:188
bool load(const iv::file::xml::node &nodePasswordRequirements)
Definition structs.cpp:175
Definition structs.hpp:305
bool save(iv::file::xml::node &nodeTimeSyncSettings) const
Definition structs.cpp:444
bool load(const iv::file::xml::node &nodeTimeSyncSettings)
Definition structs.cpp:417