cutelyst 4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
minimal.cpp
1/*
2 * SPDX-FileCopyrightText: (C) 2013-2022 Daniel Nicoletti <dantti12@gmail.com>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5#include "minimal.h"
6
7#include <QVariant>
8
9using namespace Cutelyst;
10
12 : m_idField(idField)
13{
14}
15
19
21{
22 m_users << user;
23}
24
26{
27 Q_UNUSED(c)
29 const QString id = userInfo.value(m_idField);
30
31 const auto users = m_users;
32 for (const AuthenticationUser &user : users) {
33 if (user.id() == id) {
34 ret = user;
35 break;
36 }
37 }
38
39 return ret;
40}
41
43{
44 Q_UNUSED(c);
45 return user.id();
46}
47
49{
50 return findUser(c,
51 {
52 {m_idField, frozenUser.toString()},
53 });
54}
Container for user data retrieved from an AuthenticationStore.
The Cutelyst Context.
Definition context.h:42
StoreMinimal(const QString &idField)
Definition minimal.cpp:11
void addUser(const AuthenticationUser &user)
Definition minimal.cpp:20
AuthenticationUser findUser(Context *c, const ParamsMultiMap &userInfo) override final
Definition minimal.cpp:25
AuthenticationUser fromSession(Context *c, const QVariant &frozenUser) override final
Definition minimal.cpp:48
virtual ~StoreMinimal() override
Definition minimal.cpp:16
QVariant forSession(Context *c, const AuthenticationUser &user) override final
Definition minimal.cpp:42
The Cutelyst namespace holds all public Cutelyst API.
T value(const Key &key, const T &defaultValue) const const
QString toString() const const