Add missing user feature
This commit is contained in:
parent
af7d8ab5c8
commit
3ec99d9632
2 changed files with 16 additions and 2 deletions
|
|
@ -1,5 +1,10 @@
|
|||
#include "user.h"
|
||||
|
||||
UserType User::getUserType() const
|
||||
{
|
||||
return mUserType;
|
||||
}
|
||||
|
||||
UID User::uID() const {
|
||||
return mUID;
|
||||
}
|
||||
|
|
@ -32,13 +37,14 @@ PID User::getCurrentProfession() const {
|
|||
return mCurrentProfession;
|
||||
}
|
||||
|
||||
User User::createUser(QString login, QString password,
|
||||
User User::createUser(QString login, QString password, UserType userType,
|
||||
QString firstName, QString secondName, QString patronymic) {
|
||||
User u;
|
||||
|
||||
u.mUID = QUuid::createUuid();
|
||||
u.mLogin = login;
|
||||
u.mPassword = password;
|
||||
u.mUserType = userType;
|
||||
u.mFirstName = firstName;
|
||||
u.mSecondName = secondName;
|
||||
u.mPatronymic = patronymic;
|
||||
|
|
|
|||
|
|
@ -10,11 +10,18 @@
|
|||
typedef QUuid UID;
|
||||
typedef QVector<PID> ProfessionsList;
|
||||
|
||||
enum class UserType {
|
||||
ADMINISTRATOR,
|
||||
DISPATCHER,
|
||||
WORKER
|
||||
};
|
||||
|
||||
class User {
|
||||
private:
|
||||
UID mUID;
|
||||
QString mLogin;
|
||||
QString mPassword;
|
||||
UserType mUserType;
|
||||
QString mFirstName;
|
||||
QString mSecondName;
|
||||
QString mPatronymic;
|
||||
|
|
@ -27,13 +34,14 @@ public:
|
|||
UID uID() const;
|
||||
QString getLogin() const;
|
||||
bool checkPassword(const QString &password);
|
||||
UserType getUserType() const;
|
||||
QString firstName() const;
|
||||
QString secondName() const;
|
||||
QString patronymic() const;
|
||||
ProfessionsList getProfessions() const;
|
||||
PID getCurrentProfession() const;
|
||||
|
||||
static User createUser(QString login, QString password,
|
||||
static User createUser(QString login, QString password, UserType userType,
|
||||
QString firstName, QString secondName, QString patronymic);
|
||||
|
||||
bool addProfession(const Profession &p);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue