You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
952 B
C++
39 lines
952 B
C++
9 years ago
|
#include "permissionservice.h"
|
||
|
|
||
|
PermissionService::PermissionService()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
PermissionService::~PermissionService()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
QList<QSharedPointer<Permission> > PermissionService::forPlugin(const QString &pluginId)
|
||
|
{
|
||
|
Transaction tr;
|
||
|
odb::database *db = Context::instance().db();
|
||
|
permQuery q(permQuery::pluginId == pluginId);
|
||
|
permResult result = db->query<Permission>(q);
|
||
|
|
||
|
QList<QSharedPointer<Permission> > ret;
|
||
|
for (permResult::iterator it = result.begin(); it != result.end(); it++)
|
||
|
{
|
||
|
ret.append(it.load());
|
||
|
}
|
||
|
|
||
|
tr.commit();
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
QSharedPointer<Permission> PermissionService::forNameAndPlugin(const QString &name, const QString &pluginId)
|
||
|
{
|
||
|
Transaction tr;
|
||
|
odb::database *db = Context::instance().db();
|
||
|
permQuery q(permQuery::pluginId == pluginId && permQuery::permissionName == name);
|
||
|
QSharedPointer<Permission> p = db->query_one<Permission>(q);
|
||
|
|
||
|
tr.commit();
|
||
|
return p;
|
||
|
}
|
||
|
|