7#include <QStringBuilder>
16namespace swift::misc::network
25 m_password(password.trimmed())
43 if (m_realname.isEmpty())
45 return QStringLiteral(
"<no realname>");
53 user.
setDbKey(json.value(
"id").toInt(-1));
56 user.
setUsername(json.value(
"username").toString());
57 user.
setEmail(json.value(
"email").toString(
""));
58 user.
setCountry(
CCountry(json.value(
"country").toString(), json.value(
"countryname").toString()));
59 user.
setEnabled(json.value(
"enabled").toBool());
118 if (IDatastoreObjectWithIntegerKey::canHandleIndex(index))
120 return IDatastoreObjectWithIntegerKey::propertyByIndex(index);
141 if (IDatastoreObjectWithIntegerKey::canHandleIndex(index))
143 IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant);
IconIndex
Index for each icon, allows to send them via DBus, efficiently store them, etc.
A sequence of log categories.
Non-owning reference to a CPropertyIndex with a subset of its features.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
void push_back(const T &value)
Appends an element at the end of the sequence.
Streamable status message, e.g.
static constexpr auto SeverityWarning
Status severities.
Status messages, e.g. from Core -> GUI.
IDatastoreObjectWithIntegerKey()
Constructor.
QString getDbKeyAsString() const
DB key as string.
void setDbKey(int key)
Set the DB key.
QString getDbKeyAsStringInParentheses(const QString &prefix={}) const
Db key in parentheses, e.g. "(3)".
bool hasValidDbKey() const
Has valid DB key.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
void setVatsimId(int id)
Set id.
bool isAuthenticated() const
Authenticated.
CAuthenticatedUser()=default
Default constructor.
QString convertToQString(bool i18n=false) const
Cast as QString.
void setRealName(const QString &realname)
Set real name.
bool canDirectlyWriteModels() const
Entitled to directly update models.
QString getRealNameAndId() const
Full name + id.
bool hasRole(const QString &roleName) const
Has role?
static CAuthenticatedUser fromDatabaseJson(const QJsonObject &json)
From our database JSON format.
void setAuthenticated(bool authenticated)
Authenticated.
bool hasValidRealName() const
Valid real name?
swift::misc::CIcons::IconIndex toIcon() const
As icon, not implemented by all classes.
bool hasBulkRole() const
Has bulk role?
void setEmail(const QString &email)
Set email.
bool hasValidCredentials() const
Valid credentials?
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
void setCountry(const swift::misc::CCountry &country)
Country.
bool isEnabled() const
Enabled.
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
void setRoles(const CRoleList &roles)
Roles.
swift::misc::CStatusMessageList validate() const
Validate, provide details about issues.
bool hasMappingAdminRole() const
Admin?
void setEnabled(bool enabled)
Enabled.
bool hasAdminRole() const
Admin?
void setPassword(const QString &pw)
Set password.
bool hasBulkAddRole() const
Has bulk add role?
void setUsername(const QString &username)
Set username.
bool isValid() const
Valid user object?
ColumnIndex
Properties by index.
Value object encapsulating a list of servers.
static CRoleList fromDatabaseJson(const QJsonArray &array)
From our database JSON format.
QString simplified() const const
QString toUpper() const const
QString trimmed() const const
QVariant fromValue(T &&value)
int toInt(bool *ok) const const
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.