6 #ifndef SWIFT_MISC_NETWORK_AUTHENTICATEDUSER_H
7 #define SWIFT_MISC_NETWORK_AUTHENTICATEDUSER_H
12 #include <QStringList>
25 namespace swift::misc::network
38 IndexEmail = swift::misc::CPropertyIndexRef::GlobalIndexCAuthenticatedUser,
52 CAuthenticatedUser(
int id,
const QString &realname,
const QString &email =
"",
const QString &password =
"");
58 QString getRealNameAndId()
const;
61 void setRealName(
const QString &realname);
67 void setUsername(
const QString &username);
73 void setPassword(
const QString &pw) { m_password = pw.trimmed(); }
76 bool isValid()
const {
return !m_realname.isEmpty() && this->hasValidDbKey(); }
88 const QString &
getEmail()
const {
return m_email; }
91 void setEmail(
const QString &email) { m_email = email.trimmed(); }
112 bool hasRole(
const QString &roleName)
const {
return m_roles.hasRole(roleName); }
115 bool hasAnyRole(
const QStringList &roles)
const {
return m_roles.hasAnyRole(roles); }
124 bool hasAdminRole()
const;
127 bool hasMappingAdminRole()
const;
130 bool hasBulkRole()
const;
133 bool hasBulkAddRole()
const;
139 bool isAuthenticated()
const;
148 bool canDirectlyWriteModels()
const;
160 QString convertToQString(
bool i18n =
false)
const;
172 bool m_enabled =
false;
173 bool m_authenticated =
false;
IconIndex
Index for each icon, allows to send them via DBus, efficiently store them, etc.
Non-owning reference to a CPropertyIndex with a subset of its features.
Status messages, e.g. from Core -> GUI.
Mix of the most commonly used mixin classes.
Class from which a derived class can inherit datastore-related functions.
ColumnIndex
Property index.
Value object encapsulating information of an authentiated user.
void setVatsimId(int id)
Set id.
const QString & getUsername() const
Username.
QString getRolesAsString() const
Roles.
const QString & getPassword() const
Get password.
const QString & getRealName() const
Get full name.
bool hasRole(const QString &roleName) const
Has role?
void setAuthenticated(bool authenticated)
Authenticated.
bool hasValidRealName() const
Valid real name?
void setEmail(const QString &email)
Set email.
const QString & getEmail() const
Get email.
bool hasValidCredentials() const
Valid credentials?
const swift::misc::CCountry & getCountry() const
Country.
void setCountry(const swift::misc::CCountry &country)
Country.
bool hasAnyRole(const QStringList &roles) const
Has any role?
bool isEnabled() const
Enabled.
const CRoleList & getRoles() const
Roles.
void setRoles(const CRoleList &roles)
Roles.
bool hasValidEmail() const
Valid email?
void setEnabled(bool enabled)
Enabled.
void setPassword(const QString &pw)
Set password.
int getVatsimId() const
Get id.
bool isValid() const
Valid user object?
Value object encapsulating a list of servers.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...