User Management

By default, our user management system manages users according to the __userTable__. You can refer to the following SQL statements to establish the __userTable__.

CREATE
1
2
3
4
5
6
7
8
9
  CREATE TABLE IF NOT EXISTS __userTable__ (
    userName TEXT UNIQUE NOT NULL,
    department TEXT,
    password VARCHAR(40, 40) NOT NULL,
    registerTime DATETIME DEFAULT (DATETIME('now', 'localtime')) NOT NULL,
    lastActiveTime DATETIME DEFAULT (DATETIME('now', 'localtime')) NOT NULL,
    loginTryTime INT DEFAULT 0 NOT NULL,
    permission INT DEFAULT 0 NOT NULL
  );

In the _\userTable__, you need to create at least the following columns, userName, password, registerTime, lastActiveTime, loginTryTime, permission, other cloumns can be created or deleted according to your needs.


userName is the name used by users when they login. This column must be unique, because this column is the only token we use to distinguish users.

password is the password used by users when they login. This column is stored in hash mode. Manual modification will cause users unable to login normally, and can only be modified through the Modify entry of the report platform. If the user forgets his password and cannot change the password, You can delete his password, let the user login in with empty password, and then change the password. Or you can delete this user record to allow users to re-register.

registerTime is the time when the user registers his account. You can quickly filter out new registered users by sorting this column.

lastActiveTime is the last time when the user successfully logged in. This column will be updated automatically, and it is also an important basis for the reporting platform to count users’ attempts to login in the last day.。

loginTryTime is the number of times a user failed in the last continuous login. If the number of login failures in a day exceeds maxLoginTryTime , the account will be considered as an abnormal account, and be locked. The locked account will be automatically unlocked at users’ first login on the next date, and if users login successfully, the loginTryTime will be automatically cleared.

permission is whether users are allowed to login. The value of the newly registered user is 0. You need to manually change this value to 1 to allow the user to login normally. You can also change the value of a particular user to 0 to lock his account.

_\userTable__Other columns can be created according to actual needs, and any columns you create can be used as user identity information to manage user privileges. For example, if we create a department column to represent the user’s department, then in the subsequent permission management system, we can restrict the user to access only the data of his department.

In fact, you don’t need to maintain _\userTable__ from time to time. You only need to update the identity information of new users after they register and grant them permission to login in permission. Other user-related items can be automatically completed by the reporting platform.