Created data sructures for user and permissions support
parent
6bc7fd8762
commit
2fc1090ed3
@ -0,0 +1,76 @@
|
||||
#include "permission.h"
|
||||
|
||||
Permission::Permission(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
}
|
||||
int Permission::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void Permission::setId(int id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
QString Permission::pluginId() const
|
||||
{
|
||||
return m_pluginId;
|
||||
}
|
||||
|
||||
void Permission::setPluginId(const QString &pluginId)
|
||||
{
|
||||
m_pluginId = pluginId;
|
||||
}
|
||||
QString Permission::permissionName() const
|
||||
{
|
||||
return m_permissionName;
|
||||
}
|
||||
|
||||
void Permission::setPermissionName(const QString &permissionName)
|
||||
{
|
||||
m_permissionName = permissionName;
|
||||
}
|
||||
QDateTime Permission::lastModDate() const
|
||||
{
|
||||
return m_lastModDate;
|
||||
}
|
||||
|
||||
void Permission::setLastModDate(const QDateTime &lastModDate)
|
||||
{
|
||||
m_lastModDate = lastModDate;
|
||||
}
|
||||
QDateTime Permission::createDate() const
|
||||
{
|
||||
return m_createDate;
|
||||
}
|
||||
|
||||
void Permission::setCreateDate(const QDateTime &createDate)
|
||||
{
|
||||
m_createDate = createDate;
|
||||
}
|
||||
bool Permission::active() const
|
||||
{
|
||||
return m_active;
|
||||
}
|
||||
|
||||
void Permission::setActive(bool active)
|
||||
{
|
||||
m_active = active;
|
||||
}
|
||||
QList<QWeakPointer<Role> > Permission::listRoles() const
|
||||
{
|
||||
return m_listRoles;
|
||||
}
|
||||
|
||||
void Permission::setListRoles(const QList<QWeakPointer<Role> > &listRoles)
|
||||
{
|
||||
m_listRoles = listRoles;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,62 @@
|
||||
#ifndef PERMISSION_H
|
||||
#define PERMISSION_H
|
||||
|
||||
#include <QObject>
|
||||
#include "role.h"
|
||||
#include <QSharedPointer>
|
||||
#include <QList>
|
||||
#include <QWeakPointer>
|
||||
#include <QDateTime>
|
||||
#include <odb/core.hxx>
|
||||
|
||||
class Role;
|
||||
|
||||
#pragma db object
|
||||
class Permission : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString pluginId READ pluginId WRITE setPluginId)
|
||||
Q_PROPERTY(QString permissionName READ permissionName WRITE setPermissionName)
|
||||
Q_PROPERTY(QDateTime lastModDate READ lastModDate WRITE setLastModDate)
|
||||
Q_PROPERTY(QDateTime createDate READ createDate WRITE setCreateDate)
|
||||
Q_PROPERTY(bool active READ active WRITE setActive)
|
||||
public:
|
||||
explicit Permission(QObject *parent = 0);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
QString pluginId() const;
|
||||
void setPluginId(const QString &pluginId);
|
||||
|
||||
QString permissionName() const;
|
||||
void setPermissionName(const QString &permissionName);
|
||||
|
||||
QDateTime lastModDate() const;
|
||||
void setLastModDate(const QDateTime &lastModDate);
|
||||
|
||||
QDateTime createDate() const;
|
||||
void setCreateDate(const QDateTime &createDate);
|
||||
|
||||
bool active() const;
|
||||
void setActive(bool active);
|
||||
|
||||
QList<QWeakPointer<Role> > listRoles() const;
|
||||
void setListRoles(const QList<QWeakPointer<Role> > &listRoles);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
QString m_pluginId;
|
||||
QString m_permissionName;
|
||||
QDateTime m_lastModDate;
|
||||
QDateTime m_createDate;
|
||||
bool m_active;
|
||||
#pragma db value_not_null inverse(m_listPermissions)
|
||||
QList<QWeakPointer<Role> > m_listRoles;
|
||||
|
||||
};
|
||||
|
||||
#endif // PERMISSION_H
|
@ -0,0 +1,76 @@
|
||||
#include "role.h"
|
||||
|
||||
Role::Role(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
}
|
||||
int Role::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void Role::setId(int id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
QString Role::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void Role::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
QDateTime Role::lastModDate() const
|
||||
{
|
||||
return m_lastModDate;
|
||||
}
|
||||
|
||||
void Role::setLastModDate(const QDateTime &lastModDate)
|
||||
{
|
||||
m_lastModDate = lastModDate;
|
||||
}
|
||||
QDateTime Role::createDate() const
|
||||
{
|
||||
return m_createDate;
|
||||
}
|
||||
|
||||
void Role::setCreateDate(const QDateTime &createDate)
|
||||
{
|
||||
m_createDate = createDate;
|
||||
}
|
||||
bool Role::active() const
|
||||
{
|
||||
return m_active;
|
||||
}
|
||||
|
||||
void Role::setActive(bool active)
|
||||
{
|
||||
m_active = active;
|
||||
}
|
||||
QList<QWeakPointer<User> > Role::listUsers() const
|
||||
{
|
||||
return m_listUsers;
|
||||
}
|
||||
|
||||
void Role::setListUsers(const QList<QWeakPointer<User> > &listUsers)
|
||||
{
|
||||
m_listUsers = listUsers;
|
||||
}
|
||||
QList<QSharedPointer<Permission> > Role::listPermissions() const
|
||||
{
|
||||
return m_listPermissions;
|
||||
}
|
||||
|
||||
void Role::setListPermissions(const QList<QSharedPointer<Permission> > &listPermissions)
|
||||
{
|
||||
m_listPermissions = listPermissions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,66 @@
|
||||
#ifndef ROLE_H
|
||||
#define ROLE_H
|
||||
|
||||
#include <QObject>
|
||||
#include "user.h"
|
||||
#include "permission.h"
|
||||
#include <QSharedPointer>
|
||||
#include <QList>
|
||||
#include <QWeakPointer>
|
||||
#include <QDateTime>
|
||||
#include <odb/core.hxx>
|
||||
|
||||
class Permission;
|
||||
class User;
|
||||
|
||||
#pragma db object
|
||||
class Role : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(QDateTime lastModDate READ lastModDate WRITE setLastModDate)
|
||||
Q_PROPERTY(QDateTime createDate READ createDate WRITE setCreateDate)
|
||||
Q_PROPERTY(bool active READ active WRITE setActive)
|
||||
public:
|
||||
explicit Role(QObject *parent = 0);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
|
||||
QDateTime lastModDate() const;
|
||||
void setLastModDate(const QDateTime &lastModDate);
|
||||
|
||||
QDateTime createDate() const;
|
||||
void setCreateDate(const QDateTime &createDate);
|
||||
|
||||
bool active() const;
|
||||
void setActive(bool active);
|
||||
|
||||
QList<QWeakPointer<User> > listUsers() const;
|
||||
void setListUsers(const QList<QWeakPointer<User> > &listUsers);
|
||||
|
||||
QList<QSharedPointer<Permission> > listPermissions() const;
|
||||
void setListPermissions(const QList<QSharedPointer<Permission> > &listPermissions);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
QString m_name;
|
||||
QDateTime m_lastModDate;
|
||||
QDateTime m_createDate;
|
||||
bool m_active;
|
||||
#pragma db value_not_null inverse(m_listRoles)
|
||||
QList<QWeakPointer<User> > m_listUsers;
|
||||
#pragma db value_not_null unordered
|
||||
QList<QSharedPointer<Permission> > m_listPermissions;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // ROLE_H
|
Loading…
Reference in New Issue