user model: added enabled column

This commit is contained in:
Albert S. 2019-05-03 15:56:08 +02:00
parent a202c47336
commit b29194f0d9
2 changed files with 12 additions and 11 deletions

View File

@ -1,6 +1,6 @@
CREATE TABLE page(id INTEGER PRIMARY KEY, name varchar(256), lastrevision integer, visible integer DEFAULT 1); CREATE TABLE page(id INTEGER PRIMARY KEY, name varchar(256), lastrevision integer, visible integer DEFAULT 1);
CREATE TABLE user(id INTEGER PRIMARY KEY,username varchar(64), CREATE TABLE user(id INTEGER PRIMARY KEY,username varchar(64),
password blob, salt blob, permissions integer); password blob, salt blob, permissions integer, enabled integer DEFAULT 1);
CREATE TABLE session(id INTEGER PRIMARY KEY, csrf_token varchar(32), CREATE TABLE session(id INTEGER PRIMARY KEY, csrf_token varchar(32),
creationtime date, userid integer , token varchar(32)); creationtime date, userid integer , token varchar(32));
CREATE TABLE permissions(id INTEGER PRIMARY KEY, permissions integer, CREATE TABLE permissions(id INTEGER PRIMARY KEY, permissions integer,

21
user.h
View File

@ -8,16 +8,17 @@ class User
private: private:
static User anonUser; static User anonUser;
public: public:
static const User &Anonymous(); static const User &Anonymous();
static void setAnon(User u) static void setAnon(User u)
{ {
User::anonUser = std::move(u); User::anonUser = std::move(u);
} }
std::string login; std::string login;
std::vector<char> password; std::vector<char> password;
std::vector<char> salt; std::vector<char> salt;
Permissions permissions; bool enabled;
User(); Permissions permissions;
User();
}; };