|
|
|
#include "role.h"
|
|
|
|
|
|
|
|
QX_REGISTER_CPP_CORE(Role)
|
|
|
|
|
|
|
|
namespace qx {
|
|
|
|
template<> void register_class(QxClass<Role>& t) {
|
|
|
|
t.setName("Role");
|
|
|
|
t.id(&Role::m_id, "id");
|
|
|
|
t.data(&Role::m_name, "name");
|
|
|
|
t.data(&Role::m_lastModDate, "lastModDate");
|
|
|
|
t.data(&Role::m_createDate, "createDate");
|
|
|
|
t.data(&Role::m_active, "active");
|
|
|
|
|
|
|
|
t.relationManyToMany(&Role::m_listPermissions, "object_id_fk", "Role_listPermissions", "object_id", "value");
|
|
|
|
t.relationManyToMany(&Role::m_listUsers, "value_fk", "User_listRoles", "value", "object_id");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Role::Role(QObject *parent) :
|
|
|
|
QObject(parent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
long Role::id() const
|
|
|
|
{
|
|
|
|
return m_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Role::setId(long 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<QSharedPointer<User> > Role::listUsers() const
|
|
|
|
{
|
|
|
|
return m_listUsers;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Role::setListUsers(const QList<QSharedPointer<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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Role::addPermission(QSharedPointer<Permission> perm)
|
|
|
|
{
|
|
|
|
m_listPermissions.append(perm);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Role::clearPermissions()
|
|
|
|
{
|
|
|
|
m_listPermissions.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|