Fix allowed things loading
This commit is contained in:
parent
82fe7c7ae3
commit
cfe4328776
@ -311,6 +311,9 @@ JsonReply *UsersHandler::RemoveUser(const QVariantMap ¶ms, const JsonContext
|
|||||||
JsonReply *UsersHandler::SetUserScopes(const QVariantMap ¶ms, const JsonContext &context)
|
JsonReply *UsersHandler::SetUserScopes(const QVariantMap ¶ms, const JsonContext &context)
|
||||||
{
|
{
|
||||||
Q_UNUSED(context)
|
Q_UNUSED(context)
|
||||||
|
|
||||||
|
qCWarning(dcJsonRpc()) << params;
|
||||||
|
|
||||||
QString username = params.value("username").toString();
|
QString username = params.value("username").toString();
|
||||||
Types::PermissionScopes scopes = Types::scopesFromStringList(params.value("scopes").toStringList());
|
Types::PermissionScopes scopes = Types::scopesFromStringList(params.value("scopes").toStringList());
|
||||||
QList<ThingId> allowedThingIds = Types::thingIdsFromStringList(params.value("allowedThingIds").toStringList());
|
QList<ThingId> allowedThingIds = Types::thingIdsFromStringList(params.value("allowedThingIds").toStringList());
|
||||||
|
|||||||
@ -39,6 +39,7 @@ class UserInfo
|
|||||||
Q_PROPERTY(QString email READ email)
|
Q_PROPERTY(QString email READ email)
|
||||||
Q_PROPERTY(QString displayName READ displayName)
|
Q_PROPERTY(QString displayName READ displayName)
|
||||||
Q_PROPERTY(Types::PermissionScopes scopes READ scopes)
|
Q_PROPERTY(Types::PermissionScopes scopes READ scopes)
|
||||||
|
Q_PROPERTY(QList<ThingId> allowedThingIds READ allowedThingIds)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UserInfo();
|
UserInfo();
|
||||||
|
|||||||
@ -56,8 +56,11 @@ QStringList Types::thingIdsToStringList(const QList<ThingId> &thingIds)
|
|||||||
QList<ThingId> Types::thingIdsFromStringList(const QStringList &stringList)
|
QList<ThingId> Types::thingIdsFromStringList(const QStringList &stringList)
|
||||||
{
|
{
|
||||||
QList<ThingId> thingIds;
|
QList<ThingId> thingIds;
|
||||||
foreach (const QString &idString, stringList)
|
foreach (const QString &idString, stringList) {
|
||||||
thingIds.append(ThingId(idString));
|
if (!idString.isEmpty()) {
|
||||||
|
thingIds.append(ThingId(idString));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return thingIds;
|
return thingIds;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user