mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
- changed login server database to community database
- adjusted table names in login server queries - removed roles model code since its is unused/empty
This commit is contained in:
parent
c65ac49594
commit
3e726fbe82
@ -17,7 +17,7 @@ phpServer.host = nginx
|
|||||||
loginServer.path = http://localhost/account
|
loginServer.path = http://localhost/account
|
||||||
loginServer.default_locale = de
|
loginServer.default_locale = de
|
||||||
loginServer.db.host = mariadb
|
loginServer.db.host = mariadb
|
||||||
loginServer.db.name = gradido_login
|
loginServer.db.name = gradido_community
|
||||||
loginServer.db.user = root
|
loginServer.db.user = root
|
||||||
loginServer.db.password =
|
loginServer.db.password =
|
||||||
loginServer.db.port = 3306
|
loginServer.db.port = 3306
|
||||||
|
|||||||
@ -19,7 +19,7 @@ namespace model {
|
|||||||
|
|
||||||
|
|
||||||
// generic db operations
|
// generic db operations
|
||||||
const char* getTableName() const { return "app_access_tokens"; }
|
const char* getTableName() const { return "login_app_access_tokens"; }
|
||||||
std::string toString();
|
std::string toString();
|
||||||
|
|
||||||
inline Poco::UInt64 getCode() const { return mAccessCode; }
|
inline Poco::UInt64 getCode() const { return mAccessCode; }
|
||||||
|
|||||||
@ -34,7 +34,7 @@ namespace model {
|
|||||||
ElopageBuy();
|
ElopageBuy();
|
||||||
|
|
||||||
// generic db operations
|
// generic db operations
|
||||||
const char* getTableName() const { return "elopage_buys"; }
|
const char* getTableName() const { return "login_elopage_buys"; }
|
||||||
|
|
||||||
std::string toString();
|
std::string toString();
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ namespace model {
|
|||||||
|
|
||||||
|
|
||||||
// generic db operations
|
// generic db operations
|
||||||
const char* getTableName() const { return "email_opt_in"; }
|
const char* getTableName() const { return "login_email_opt_in"; }
|
||||||
std::string toString();
|
std::string toString();
|
||||||
|
|
||||||
inline Poco::UInt64 getCode() const { return mEmailVerificationCode; }
|
inline Poco::UInt64 getCode() const { return mEmailVerificationCode; }
|
||||||
|
|||||||
@ -17,7 +17,7 @@ namespace model {
|
|||||||
Group(GroupTuple userTuple);
|
Group(GroupTuple userTuple);
|
||||||
|
|
||||||
// generic db operations
|
// generic db operations
|
||||||
const char* getTableName() const { return "groups"; }
|
const char* getTableName() const { return "login_groups"; }
|
||||||
std::string toString();
|
std::string toString();
|
||||||
|
|
||||||
inline const std::string& getAlias() const { return mAlias; }
|
inline const std::string& getAlias() const { return mAlias; }
|
||||||
|
|||||||
@ -30,7 +30,7 @@ namespace model {
|
|||||||
|
|
||||||
|
|
||||||
// generic db operations
|
// generic db operations
|
||||||
const char* getTableName() const { return "pending_tasks"; }
|
const char* getTableName() const { return "login_pending_tasks"; }
|
||||||
std::string toString();
|
std::string toString();
|
||||||
|
|
||||||
//! \brief update table row with current request
|
//! \brief update table row with current request
|
||||||
|
|||||||
@ -1,60 +0,0 @@
|
|||||||
#ifndef GRADIDO_LOGIN_SERVER_MODEL_TABLE_ROLES_INCLUDE
|
|
||||||
#define GRADIDO_LOGIN_SERVER_MODEL_TABLE_ROLES_INCLUDE
|
|
||||||
|
|
||||||
#include "ModelBase.h"
|
|
||||||
#include "Poco/Types.h"
|
|
||||||
#include "Poco/Tuple.h"
|
|
||||||
|
|
||||||
namespace model {
|
|
||||||
namespace table {
|
|
||||||
|
|
||||||
enum RoleType {
|
|
||||||
ROLE_ADMIN = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
class Roles : public ModelBase
|
|
||||||
{
|
|
||||||
|
|
||||||
};
|
|
||||||
/*
|
|
||||||
typedef Poco::Tuple<int, int, Poco::UInt64, int> EmailOptInTuple;
|
|
||||||
|
|
||||||
class EmailOptIn : public ModelBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
EmailOptIn(const Poco::UInt64& code, int user_id, EmailOptInType type);
|
|
||||||
EmailOptIn(const Poco::UInt64& code, EmailOptInType type);
|
|
||||||
EmailOptIn(const EmailOptInTuple& tuple);
|
|
||||||
EmailOptIn();
|
|
||||||
~EmailOptIn();
|
|
||||||
|
|
||||||
// generic db operations
|
|
||||||
const char* getTableName() { return "email_opt_in"; }
|
|
||||||
std::string toString();
|
|
||||||
|
|
||||||
inline Poco::UInt64 getCode() const { return mEmailVerificationCode; }
|
|
||||||
inline int getUserId() const { return mUserId; }
|
|
||||||
inline EmailOptInType getType() const { return static_cast<EmailOptInType>(mType); }
|
|
||||||
inline void setCode(Poco::UInt64 code) { mEmailVerificationCode = code; }
|
|
||||||
inline void setUserId(int user_Id) { mUserId = user_Id; }
|
|
||||||
|
|
||||||
static const char* typeToString(EmailOptInType type);
|
|
||||||
protected:
|
|
||||||
Poco::Data::Statement _loadFromDB(Poco::Data::Session session, const std::string& fieldName);
|
|
||||||
Poco::Data::Statement _loadIdFromDB(Poco::Data::Session session);
|
|
||||||
Poco::Data::Statement _loadMultipleFromDB(Poco::Data::Session session, const std::string& fieldName);
|
|
||||||
Poco::Data::Statement _loadFromDB(Poco::Data::Session session, const std::vector<std::string>& fieldNames, MysqlConditionType conditionType = MYSQL_CONDITION_AND);
|
|
||||||
Poco::Data::Statement _insertIntoDB(Poco::Data::Session session);
|
|
||||||
|
|
||||||
int mUserId;
|
|
||||||
// data type must be a multiple of 4
|
|
||||||
Poco::UInt64 mEmailVerificationCode;
|
|
||||||
int mType;
|
|
||||||
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif //GRADIDO_LOGIN_SERVER_MODEL_TABLE_ROLES_INCLUDE
|
|
||||||
@ -83,11 +83,11 @@ namespace model {
|
|||||||
|
|
||||||
|
|
||||||
if (mPasswordHashed) {
|
if (mPasswordHashed) {
|
||||||
insert << "INSERT INTO users (email, first_name, last_name, username, description, password, email_hash, language, group_id, publisher_id) VALUES(?,?,?,?,?,?,?,?,?,?);",
|
insert << "INSERT INTO " << getTableName() << " (email, first_name, last_name, username, description, password, email_hash, language, group_id, publisher_id) VALUES(?,?,?,?,?,?,?,?,?,?);",
|
||||||
use(mEmail), use(mFirstName), use(mLastName), use(mUsername), use(mDescription), bind(mPasswordHashed), use(mEmailHash), use(mLanguageKey), use(mGroupId), use(mPublisherId);
|
use(mEmail), use(mFirstName), use(mLastName), use(mUsername), use(mDescription), bind(mPasswordHashed), use(mEmailHash), use(mLanguageKey), use(mGroupId), use(mPublisherId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
insert << "INSERT INTO users (email, first_name, last_name, username, description, email_hash, language, group_id, publisher_id) VALUES(?,?,?,?,?,?,?,?,?);",
|
insert << "INSERT INTO " << getTableName() << " (email, first_name, last_name, username, description, email_hash, language, group_id, publisher_id) VALUES(?,?,?,?,?,?,?,?,?);",
|
||||||
use(mEmail), use(mFirstName), use(mLastName), use(mUsername), use(mDescription), use(mEmailHash), use(mLanguageKey), use(mGroupId), use(mPublisherId);
|
use(mEmail), use(mFirstName), use(mLastName), use(mUsername), use(mDescription), use(mEmailHash), use(mLanguageKey), use(mGroupId), use(mPublisherId);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -103,9 +103,11 @@ namespace model {
|
|||||||
}
|
}
|
||||||
Poco::Data::Statement select(session);
|
Poco::Data::Statement select(session);
|
||||||
|
|
||||||
|
std::string table_name_user_roles = "login_user_roles"
|
||||||
|
|
||||||
select << "SELECT " << getTableName() << ".id, email, first_name, last_name, username, description, password, pubkey, privkey, email_hash, created, email_checked, language, disabled, group_id, publisher_id, user_roles.role_id "
|
select << "SELECT " << getTableName() << ".id, email, first_name, last_name, username, description, password, pubkey, privkey, email_hash, created, email_checked, language, disabled, group_id, publisher_id, user_roles.role_id "
|
||||||
<< " FROM " << getTableName()
|
<< " FROM " << getTableName()
|
||||||
<< " LEFT JOIN user_roles ON " << getTableName() << ".id = user_roles.user_id "
|
<< " LEFT JOIN " << table_name_user_roles << " ON " << getTableName() << ".id = " << table_name_user_roles << ".user_id "
|
||||||
<< " WHERE " << _fieldName << " = ?" ,
|
<< " WHERE " << _fieldName << " = ?" ,
|
||||||
into(mID), into(mEmail), into(mFirstName), into(mLastName), into(mUsername), into(mDescription), into(mPasswordHashed),
|
into(mID), into(mEmail), into(mFirstName), into(mLastName), into(mUsername), into(mDescription), into(mPasswordHashed),
|
||||||
into(mPublicKey), into(mPrivateKey), into(mEmailHash), into(mCreated), into(mEmailChecked),
|
into(mPublicKey), into(mPrivateKey), into(mEmailHash), into(mCreated), into(mEmailChecked),
|
||||||
@ -194,7 +196,7 @@ namespace model {
|
|||||||
|
|
||||||
Poco::Data::Statement update(session);
|
Poco::Data::Statement update(session);
|
||||||
|
|
||||||
update << "UPDATE users SET password = ?, privkey = ? where id = ?;",
|
update << "UPDATE " << getTableName() << " SET password = ?, privkey = ? where id = ?;",
|
||||||
bind(mPasswordHashed), use(mPrivateKey), use(mID);
|
bind(mPasswordHashed), use(mPrivateKey), use(mID);
|
||||||
|
|
||||||
|
|
||||||
@ -221,7 +223,7 @@ namespace model {
|
|||||||
|
|
||||||
Poco::Data::Statement update(session);
|
Poco::Data::Statement update(session);
|
||||||
|
|
||||||
update << "UPDATE users SET pubkey = ?, privkey = ? where id = ?;",
|
update << "UPDATE " << getTableName() << " SET pubkey = ?, privkey = ? where id = ?;",
|
||||||
use(mPublicKey), use(mPrivateKey), use(mID);
|
use(mPublicKey), use(mPrivateKey), use(mID);
|
||||||
|
|
||||||
|
|
||||||
@ -246,7 +248,7 @@ namespace model {
|
|||||||
auto session = cm->getConnection(CONNECTION_MYSQL_LOGIN_SERVER);
|
auto session = cm->getConnection(CONNECTION_MYSQL_LOGIN_SERVER);
|
||||||
|
|
||||||
Poco::Data::Statement update(session);
|
Poco::Data::Statement update(session);
|
||||||
update << "UPDATE users SET first_name = ?, last_name = ?, username = ?, description = ?, disabled = ?, language = ?, publisher_id = ? where id = ?;",
|
update << "UPDATE " << getTableName() << " SET first_name = ?, last_name = ?, username = ?, description = ?, disabled = ?, language = ?, publisher_id = ? where id = ?;",
|
||||||
use(mFirstName), use(mLastName), use(mUsername), use(mDescription), use(mDisabled), use(mLanguageKey), use(mPublisherId), use(mID);
|
use(mFirstName), use(mLastName), use(mUsername), use(mDescription), use(mDisabled), use(mLanguageKey), use(mPublisherId), use(mID);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -54,7 +54,7 @@ namespace model {
|
|||||||
|
|
||||||
|
|
||||||
// generic db operations
|
// generic db operations
|
||||||
const char* getTableName() const { return "users"; }
|
const char* getTableName() const { return "login_users"; }
|
||||||
std::string toString();
|
std::string toString();
|
||||||
std::string toHTMLString();
|
std::string toHTMLString();
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ namespace model {
|
|||||||
UserBackup();
|
UserBackup();
|
||||||
|
|
||||||
// generic db operations
|
// generic db operations
|
||||||
const char* getTableName() const { return "user_backups"; }
|
const char* getTableName() const { return "login_user_backups"; }
|
||||||
std::string toString();
|
std::string toString();
|
||||||
|
|
||||||
inline int getUserId() const { return mUserId; }
|
inline int getUserId() const { return mUserId; }
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
#include "ModelBase.h"
|
#include "ModelBase.h"
|
||||||
#include "Poco/Types.h"
|
#include "Poco/Types.h"
|
||||||
#include "Poco/Tuple.h"
|
#include "Poco/Tuple.h"
|
||||||
//#include "Roles.h"
|
|
||||||
|
|
||||||
namespace model {
|
namespace model {
|
||||||
namespace table {
|
namespace table {
|
||||||
@ -25,7 +24,7 @@ namespace model {
|
|||||||
UserRole();
|
UserRole();
|
||||||
|
|
||||||
// generic db operations
|
// generic db operations
|
||||||
const char* getTableName() const { return "user_roles"; }
|
const char* getTableName() const { return "login_user_roles"; }
|
||||||
std::string toString();
|
std::string toString();
|
||||||
|
|
||||||
inline int getUserId() const { return mUserId; }
|
inline int getUserId() const { return mUserId; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user