diff --git a/core/data/role.cpp b/core/data/role.cpp index 9de6e48..b762753 100644 --- a/core/data/role.cpp +++ b/core/data/role.cpp @@ -95,6 +95,10 @@ void Role::clearPermissions() m_listPermissions.clear(); } +QStringList Role::eagerLoad() { + return {"object_id_fk", "value_fk"}; +} + diff --git a/core/data/role.h b/core/data/role.h index 051db01..21f265c 100644 --- a/core/data/role.h +++ b/core/data/role.h @@ -46,6 +46,8 @@ public: void addPermission(QSharedPointer perm); void clearPermissions(); + Q_INVOKABLE QStringList eagerLoad(); + private: long m_id; QString m_name; diff --git a/core/data/user.cpp b/core/data/user.cpp index 2a1a37f..9cd6af9 100644 --- a/core/data/user.cpp +++ b/core/data/user.cpp @@ -112,6 +112,10 @@ void User::setIsAdmin(bool isAdmin) m_isAdmin = isAdmin; } +QStringList User::eagerLoad() { + return {"object_id_fk"}; +} + diff --git a/core/data/user.h b/core/data/user.h index fe9e1bb..2407655 100644 --- a/core/data/user.h +++ b/core/data/user.h @@ -57,6 +57,7 @@ public: void clearRoles(); + Q_INVOKABLE QStringList eagerLoad(); private: long m_id; diff --git a/core/permissionservice.cpp b/core/permissionservice.cpp index c007719..4c94cad 100644 --- a/core/permissionservice.cpp +++ b/core/permissionservice.cpp @@ -1,4 +1,5 @@ #include "permissionservice.h" +#include "service.h" #include QList > PermissionService::forPlugin(const QString &pluginId) @@ -54,6 +55,10 @@ QSharedPointer PermissionService::loadUser(const QString &login) auto admin = srvUser.all("login = '" + login + "'"); if (admin.count() == 1) { + Service srvRole; + for (auto& role : admin[0]->listRoles()) { + srvRole.load(role); + } return admin[0]; }