cutelyst  3.7.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
authenticationuser.cpp
1 /*
2  * SPDX-FileCopyrightText: (C) 2013-2022 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #include "authenticationuser.h"
6 
7 #include <QDataStream>
8 #include <QDebug>
9 
10 using namespace Cutelyst;
11 
13 {
14 
15 }
16 
18 {
19  setId(id);
20 }
21 
22 AuthenticationUser::~AuthenticationUser()
23 {
24 }
25 
26 QVariant AuthenticationUser::id() const
27 {
28  return m_data.value(QStringLiteral("id"));
29 }
30 
31 void AuthenticationUser::setId(const QVariant &id)
32 {
33  m_data.insert(QStringLiteral("id"), id);
34 }
35 
37 {
38  return m_data.isEmpty();
39 }
40 
42 {
43  return m_data.value(QStringLiteral("authRealm")).toString();
44 }
45 
46 void AuthenticationUser::setAuthRealm(const QString &authRealm)
47 {
48  m_data.insert(QStringLiteral("authRealm"), authRealm);
49 }
50 
51 QDataStream &operator<<(QDataStream &out, const AuthenticationUser &user)
52 {
53  out << user.data();
54  return out;
55 }
56 
57 QDataStream &operator>>(QDataStream &in, AuthenticationUser &user)
58 {
59  QVariantMap map;
60  in >> map;
61  user.setData(map);
62  return in;
63 }
64 
65 QDebug operator<<(QDebug dbg, const AuthenticationUser &user)
66 {
67  const QVariantMap map = user.data();
68  const bool oldSetting = dbg.autoInsertSpaces();
69  dbg.nospace() << "AuthenticationUser(";
70  for (auto it = map.constBegin();
71  it != map.constEnd(); ++it) {
72  dbg << '(' << it.key() << ", " << it.value() << ')';
73  }
74  dbg << ')';
75  dbg.setAutoInsertSpaces(oldSetting);
76  return dbg.maybeSpace();
77 }
78 
79 #include "moc_authenticationuser.cpp"
QString authRealm()
Returns the authentication realm from which this user was retrieved.
AuthenticationUser()
Constructs a new AuthenticationUser object.
void setAuthRealm(const QString &authRealm)
Sets the authentication realm from which this user was retrieved.
bool isNull() const
Returns true if the object is null.
void setId(const QVariant &id)
Sets the unique user id restored from the store.
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8