<p class="wb_h1">User Account</p>
The User Account manager is used to manage user login account such as user account creating, modifying and deleting.<br><br>
<p class="wb_h2">1. User Table Structure</p>
User data are stored in table WB_USER.
<hr>
<table class="wb_normal" style="line-height:2" border="0">
<tr><td width="150"><b>USER_ID</b></td><td width="500">Unique user id.</td></tr>
<tr><td><b>USER_NAME</b></td><td>Unique user name.</td></tr>
<tr><td><b>DISPLAY_NAME</b></td><td>User display name.</td></tr>
<tr><td><b>PASSWORD</b></td><td>MD5 encrypted password</td></tr>
<tr><td><b>STATUS</b></td><td>Indicates whether the user account is disabled, 0 is disabled.</td></tr>
<tr><td><b>CREATE_DATE</b></td><td>Created date of the user account.</td></tr>
<tr><td><b>LOGIN_TIMES</b></td><td>Login times of the user account.</td></tr>
<tr><td><b>EMAIL</b></td><td>User email.</td></tr>
<tr><td><b>USE_LANG</b></td><td>Selected language.</td></tr>
<tr><td><b>LAST_LOGIN</b></td><td>Last login date of the user account.</td></tr>
</table>
There is an IP address field in the user account list, if user is online, IP address is available.<br><br>
<p class="wb_h2">2. Operating Buttons</p>
The following are description of some operating buttons.<br>
<hr>
<table class="wb_normal" style="line-height:2" border="0">
<tr><td width="150" colspan="2"><b>New</b></td><td width="500">Create new user.</td></tr>
<tr><td colspan="2"><b>Edit</b></td><td>Modify the selected user.</td></tr>
<tr><td colspan="2"><b>Delete</b></td><td>Delete the selected users.</td></tr>
<tr><td colspan="2"><b>Disable</b></td><td>Disable the selected users, so that this user account cannot login to the system.</td></tr>
<tr><td colspan="2"><b>Enable</b></td><td>Enable the selected users, thus this user account can login to the system.</td></tr>
<tr><td rowspan="4" width="60"><b>Search</b></td><td><b>ComboBox</b></td><td>Dynamically search users by search key word.</td></tr>
<tr><td><b>Search</b></td><td>Search users immediately.</td></tr>
<tr><td><b>Reset</b></td><td>Reset search, list all users.</td></tr>
<tr><td><b>Role</b></td><td>Search selected user with the selected role.</td></tr>
</table><br>
<p class="wb_h2">3. User Role</p>
Each user account has associated roles that indicate module accessing permissions for the account. You can use <a href="javascript:openTopic('@systool/perm.txt','Permissions Config')">Permissions Config</a> module to bind roles to modules.
The admin role has permission to access all modules, the default role equals to empty role setting, other roles can access particular modules which are binded with same roles.<br><br>
<p class="wb_h2">4. Creating User Accounts</p>
Click the New button to create a user account, in the dialog window, enter the required fields which are marked &quot;*&quot;. User Name is login name. Display Name is used for displaying. Password is login password, the password must be at least 6 characters long. And then select one or more roles for the user. Finally click OK.<br><br>
<p class="wb_h2">5. Maintain User Account by Programming</p>
You can add new user accounts programmatically. For example, if you want to create an employees table, and bind users' accounts to the employees, then you need to maintain account programmatically.<br><br>
<p class="wb_h3">5.1 Create New User Accounts</p>
<b>5.1.1 Insert User Record</b><br>
Insert user record to WB_USER table with required fields.<br>
SQL: insert into WB_USER values(uniqueUserId, uniqueUsername, displayName, md5EncryptedPassword, 1, createDate, 0, email, null, null)<br>
The uniqueUserId is a unique string, you can use API SysUtil.getId to get a unique string. The md5EncryptedPassword is MD5 encrypted value, you can use API Encrypter.getMD5 to encrypt the password.<br>
<b>5.1.2 Insert Roles Records</b><br>
Insert user roles to WB_USER_ROLE table if the user has roles.<br>
SQL: insert into WB_USER_ROLE values(uniqueUserId, roleId)<br>
The uniqueUserId is referred to USER_ID field of WB_USER table, the uniqueUserId equals to above WB_USER's uniqueUserId. The roleId is referred to ROLE_ID field of WB_ROLE table, you can get specified role's id in <a href="javascript:openTopic('@systool/role.txt','Roles Config')">Roles Config</a> module. If there are multiple roles, you should insert multiple records to WB_USER_ROLE table.<br>
<b>5.1.3 Insert Other Data</b><br>
Insert other data to relative table and do some operations, for example, insert a employee record.<br>
<b>5.1.4 Database transaction</b><br>
You should start database transaction during all operations.<br><br>
<p class="wb_h3">5.2 Update User Accounts</p>
For updating user data, please update WB_USER table. For updating user' role, please update WB_USER_ROLE table.<br><br>
<p class="wb_h3">5.3 Delete User Accounts</p>
For deleting user account, please delete records of WB_USER, WB_USER_ROLE and other user define's relative table.<br>