Fixed permission evaluation.

master
Josef Rokos 2 years ago
parent 12dd6ddba0
commit e3a5e44c33

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

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

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

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

@ -1,4 +1,5 @@
#include "permissionservice.h"
#include "service.h"
#include <QCryptographicHash>
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 + "'");
if (admin.count() == 1) {
Service<Role> srvRole;
for (auto& role : admin[0]->listRoles()) {
srvRole.load(role);
}
return admin[0];
}

Loading…
Cancel
Save