Add missing thingError fpr IO connections

This commit is contained in:
Simon Stürz 2025-10-28 10:58:35 +01:00
parent cfe4328776
commit b80ad6d839
3 changed files with 11 additions and 4 deletions

View File

@ -377,7 +377,8 @@ IntegrationsHandler::IntegrationsHandler(ThingManager *thingManager, QObject *pa
params.clear(); returns.clear();
description = "Fetch IO connections. Optionally filtered by thingId and stateTypeId.";
params.insert("o:thingId", enumValueName(Uuid));
returns.insert("ioConnections", objectRef<IOConnections>());
returns.insert("o:ioConnections", objectRef<IOConnections>());
returns.insert("thingError", enumRef<Thing::ThingError>());
registerMethod("GetIOConnections", description, params, returns, Types::PermissionScopeNone);
params.clear(); returns.clear();
@ -1144,6 +1145,7 @@ JsonReply *IntegrationsHandler::GetIOConnections(const QVariantMap &params, cons
QVariantMap returns;
QVariant bla = pack(ioConnections);
returns.insert("ioConnections", pack(ioConnections));
returns.insert("thingError", enumValueName<Thing::ThingError>(Thing::ThingErrorNoError));
return createReply(returns);
}

View File

@ -143,7 +143,6 @@ UsersHandler::UsersHandler(UserManager *userManager, QObject *parent):
params.insert("username", username);
emit UserRemoved(params);
});
}
QString UsersHandler::name() const
@ -316,8 +315,15 @@ JsonReply *UsersHandler::SetUserScopes(const QVariantMap &params, const JsonCont
QString username = params.value("username").toString();
Types::PermissionScopes scopes = Types::scopesFromStringList(params.value("scopes").toStringList());
QList<ThingId> allowedThingIds = Types::thingIdsFromStringList(params.value("allowedThingIds").toStringList());
QList<ThingId> allowedThingIds;
if (params.contains("allowedThingIds")) {
allowedThingIds = Types::thingIdsFromStringList(params.value("allowedThingIds").toStringList());
} else {
allowedThingIds = m_userManager->userInfo(username).allowedThingIds();
}
UserManager::UserError error = m_userManager->setUserScopes(username, scopes, allowedThingIds);
QVariantMap returns;
returns.insert("error", enumValueName<UserManager::UserError>(error));
return createReply(returns);

View File

@ -305,7 +305,6 @@ UserManager::UserError UserManager::setUserScopes(const QString &username, Types
}
}
QString scopesString = Types::scopesToStringList(scopes).join(',');
QString allowedThingIdsString = Types::thingIdsToStringList(thingIds).join(',');