mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-26 23:30:20 +01:00
2017-03-27 Fred Gleason <fredg@paravelsystems.com>
* Added a 'WEBAPI_AUTHS' table to the database. * Added a 'USERS.WEBAPI_AUTH_TIMEOUT' field to the database. * Incremented the database version to 260. * Added 'RDUser::webapiAuthTimeout()' and 'RDUser::setWebapiAuthTimeout()' methods in 'lib/rduser.cpp' and 'lib/rduser.h'. * Added a 'WebAPI Timeout' control to the Edit User dialog in 'rdadmin/edit_user.cpp' and 'rdadmin/edit_user.h'. * Implemented a 'CreateTicket' Web API call.
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
/*
|
||||
* Current Database Version
|
||||
*/
|
||||
#define RD_VERSION_DATABASE 259
|
||||
#define RD_VERSION_DATABASE 260
|
||||
|
||||
|
||||
#endif // DBVERSION_H
|
||||
|
||||
@@ -41,6 +41,13 @@ RDFormPost::RDFormPost(RDFormPost::Encoding encoding,unsigned maxsize,
|
||||
post_error=RDFormPost::ErrorNotInitialized;
|
||||
post_auto_delete=auto_delete;
|
||||
|
||||
//
|
||||
// Client Info
|
||||
//
|
||||
if(getenv("REMOTE_ADDR")!=NULL) {
|
||||
post_client_address.setAddress(getenv("REMOTE_ADDR"));
|
||||
}
|
||||
|
||||
//
|
||||
// Verify Transfer Type
|
||||
//
|
||||
@@ -128,6 +135,12 @@ RDFormPost::Error RDFormPost::error() const
|
||||
}
|
||||
|
||||
|
||||
QHostAddress RDFormPost::clientAddress() const
|
||||
{
|
||||
return post_client_address;
|
||||
}
|
||||
|
||||
|
||||
QStringList RDFormPost::names() const
|
||||
{
|
||||
QStringList list;
|
||||
|
||||
@@ -38,6 +38,7 @@ class RDFormPost
|
||||
bool auto_delete=true);
|
||||
~RDFormPost();
|
||||
RDFormPost::Error error() const;
|
||||
QHostAddress clientAddress() const;
|
||||
QStringList names() const;
|
||||
QVariant value(const QString &name,bool *ok=NULL);
|
||||
bool getValue(const QString &name,QHostAddress *addr,bool *ok=NULL);
|
||||
@@ -58,6 +59,7 @@ class RDFormPost
|
||||
private:
|
||||
void LoadUrlEncoding(char first);
|
||||
void LoadMultipartEncoding(char first);
|
||||
QHostAddress post_client_address;
|
||||
RDFormPost::Encoding post_encoding;
|
||||
RDFormPost::Error post_error;
|
||||
std::map<QString,QVariant> post_values;
|
||||
|
||||
@@ -137,6 +137,19 @@ void RDUser::setPhone(const QString &phone) const
|
||||
}
|
||||
|
||||
|
||||
int RDUser::webapiAuthTimeout() const
|
||||
{
|
||||
return RDGetSqlValue("USERS","LOGIN_NAME",user_name,"WEBAPI_AUTH_TIMEOUT").
|
||||
toInt();
|
||||
}
|
||||
|
||||
|
||||
void RDUser::setWebapiAuthTimeout(int sec) const
|
||||
{
|
||||
SetRow("WEBAPI_AUTH_TIMEOUT",sec);
|
||||
}
|
||||
|
||||
|
||||
bool RDUser::adminConfig() const
|
||||
{
|
||||
return RDBool(RDGetSqlValue("USERS","LOGIN_NAME",user_name,
|
||||
@@ -498,6 +511,20 @@ void RDUser::SetRow(const QString ¶m,const QString &value) const
|
||||
}
|
||||
|
||||
|
||||
void RDUser::SetRow(const QString ¶m,int value) const
|
||||
{
|
||||
RDSqlQuery *q;
|
||||
QString sql;
|
||||
|
||||
sql=QString().sprintf("UPDATE USERS SET %s=%d WHERE LOGIN_NAME=\"%s\"",
|
||||
(const char *)param,
|
||||
value,
|
||||
(const char *)user_name);
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
void RDUser::SetRow(const QString ¶m,bool value) const
|
||||
{
|
||||
SetRow(param,RDYesNo(value));
|
||||
|
||||
@@ -41,6 +41,8 @@ class RDUser
|
||||
void setDescription(const QString &desc) const;
|
||||
QString phone() const;
|
||||
void setPhone(const QString &phone) const;
|
||||
int webapiAuthTimeout() const;
|
||||
void setWebapiAuthTimeout(int sec) const;
|
||||
bool adminConfig() const;
|
||||
void setAdminConfig(bool priv) const;
|
||||
bool createCarts() const;
|
||||
@@ -102,6 +104,7 @@ class RDUser
|
||||
|
||||
private:
|
||||
void SetRow(const QString ¶m,const QString &value) const;
|
||||
void SetRow(const QString ¶m,int value) const;
|
||||
void SetRow(const QString ¶m,bool value) const;
|
||||
QString user_name;
|
||||
QString user_password;
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#define RDXPORT_COMMAND_SAVELOG 28
|
||||
#define RDXPORT_COMMAND_ADDLOG 29
|
||||
#define RDXPORT_COMMAND_DELETELOG 30
|
||||
#define RDXPORT_COMMAND_CREATETICKET 31
|
||||
|
||||
|
||||
#endif // RDXPORT_INTERFACE_H
|
||||
|
||||
Reference in New Issue
Block a user