Fixed permission evaluation.

master
Josef Rokos 1 year ago
parent 12dd6ddba0
commit e3a5e44c33

@ -95,6 +95,10 @@ void Role::clearPermissions()
m_listPermissions.clear(); m_listPermissions.clear();
} }
QStringList Role::eagerLoad() {
return {"object_id_fk", "value_fk"};
}

@ -46,6 +46,8 @@ public:
void addPermission(QSharedPointer<Permission> perm); void addPermission(QSharedPointer<Permission> perm);
void clearPermissions(); void clearPermissions();
Q_INVOKABLE QStringList eagerLoad();
private: private:
long m_id; long m_id;
QString m_name; QString m_name;

@ -112,6 +112,10 @@ void User::setIsAdmin(bool isAdmin)
m_isAdmin = isAdmin; m_isAdmin = isAdmin;
} }
QStringList User::eagerLoad() {
return {"object_id_fk"};
}

@ -57,6 +57,7 @@ public:
void clearRoles(); void clearRoles();
Q_INVOKABLE QStringList eagerLoad();
private: private:
long m_id; long m_id;

@ -1,4 +1,5 @@
#include "permissionservice.h" #include "permissionservice.h"
#include "service.h"
#include <QCryptographicHash> #include <QCryptographicHash>
QList<QSharedPointer<Permission> > PermissionService::forPlugin(const QString &pluginId) QList<QSharedPointer<Permission> > PermissionService::forPlugin(const QString &pluginId)
@ -54,6 +55,10 @@ QSharedPointer<User> PermissionService::loadUser(const QString &login)
auto admin = srvUser.all("login = '" + login + "'"); auto admin = srvUser.all("login = '" + login + "'");
if (admin.count() == 1) { if (admin.count() == 1) {
Service<Role> srvRole;
for (auto& role : admin[0]->listRoles()) {
srvRole.load(role);
}
return admin[0]; return admin[0];
} }

Loading…
Cancel
Save