From cfe4328776a01764ea55ceb91c1fd52bd6b1676b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Mon, 27 Oct 2025 15:53:38 +0100 Subject: [PATCH] Fix allowed things loading --- libnymea-core/jsonrpc/usershandler.cpp | 3 +++ libnymea-core/usermanager/userinfo.h | 1 + libnymea/types/typeutils.cpp | 7 +++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libnymea-core/jsonrpc/usershandler.cpp b/libnymea-core/jsonrpc/usershandler.cpp index 4ec96e6a..e12220a6 100644 --- a/libnymea-core/jsonrpc/usershandler.cpp +++ b/libnymea-core/jsonrpc/usershandler.cpp @@ -311,6 +311,9 @@ JsonReply *UsersHandler::RemoveUser(const QVariantMap ¶ms, const JsonContext JsonReply *UsersHandler::SetUserScopes(const QVariantMap ¶ms, const JsonContext &context) { Q_UNUSED(context) + + qCWarning(dcJsonRpc()) << params; + QString username = params.value("username").toString(); Types::PermissionScopes scopes = Types::scopesFromStringList(params.value("scopes").toStringList()); QList allowedThingIds = Types::thingIdsFromStringList(params.value("allowedThingIds").toStringList()); diff --git a/libnymea-core/usermanager/userinfo.h b/libnymea-core/usermanager/userinfo.h index ca91aeca..770b9bb5 100644 --- a/libnymea-core/usermanager/userinfo.h +++ b/libnymea-core/usermanager/userinfo.h @@ -39,6 +39,7 @@ class UserInfo Q_PROPERTY(QString email READ email) Q_PROPERTY(QString displayName READ displayName) Q_PROPERTY(Types::PermissionScopes scopes READ scopes) + Q_PROPERTY(QList allowedThingIds READ allowedThingIds) public: UserInfo(); diff --git a/libnymea/types/typeutils.cpp b/libnymea/types/typeutils.cpp index 76128f3d..7f15fad0 100644 --- a/libnymea/types/typeutils.cpp +++ b/libnymea/types/typeutils.cpp @@ -56,8 +56,11 @@ QStringList Types::thingIdsToStringList(const QList &thingIds) QList Types::thingIdsFromStringList(const QStringList &stringList) { QList thingIds; - foreach (const QString &idString, stringList) - thingIds.append(ThingId(idString)); + foreach (const QString &idString, stringList) { + if (!idString.isEmpty()) { + thingIds.append(ThingId(idString)); + } + } return thingIds; }