Navigation:  Advanced Features > Server Lua API >

Administrator

Previous pageReturn to chapter overviewNext page

 

c_CheckAdmin(string strUserName,string strPassword)

 

Parameters

[1]string   admin username

[2]string   admin password

 

Return Values

[1]bool  return true if administrator login is successful, otherwise return false

 

Remarks

Check administrator's login?

 


c_CheckAdminIp(string strUserName,string strIp)

 

Parameters

[1]string   admin username

[2]string   the client IP

 

Return Values

[1]bool  return false when IP is banned, otherwise return true

 

Remarks

Check administrator's login IP.

 


c_AdminLogout(string strSessionId)

 

Parameters

[1]string   the admin session ID

 

Return Values

nil

 

Remarks

Administrator logout.

 


c_AdminExist(string strUserName)

 

Parameters

[1]string   admin username

 

Return Values

[1]bool  return true if specified admin exists, otherwise return false

 

Remarks

Check whether the specified administrator exists.

 


c_AddAdmin(string strUserName, string strPassword, bool bReadonly, table tabAdminIpmasks)

 

Parameters

[1]string   admin username

[2]string   admin password with MD5/SHA256 encryption

[3]bool   is read-only admin?

[4]table  administrator's IPmask list which is formatted as: {{ip,refuse}}

[5]bool   is domain admin?

[6]string   all the domains which admin can manage.

[7]string   specify a base folder to limit the domain admin access.

[8]bool   whether enable two-factor authentication (TOTP)

[9]string   the TOTP secret code

 

Return Values

nil

 

Remarks

Add or modify an administrator .

 


c_DeleteAdmin(string strUserName)

 

Parameters

[1]string   admin username

 

Return Values

nil

 

Remarks

Delete an administrator.

 


c_GetAdmin(string strUsername)

 

Parameters

[1]string   admin username

 

Return Values

[1]table   administrator data table which is formatted as: {username,password,readonly,{Ipmask table},domainadmin,domainlist,mydirectory,enable_two_factor,two_factor_code}

 

Remarks

Return an administrator data table if the specified admin exists, otherwise return nil.

 


c_GetAdminType()

 

Parameters

[1]string   the administrator name

 

Return Values

[1]bool   return true if administrator is read-only admin, otherwise return false

 

Remarks

Get the administrator's type.

 


c_GetAdminList()

 

Parameters

nil

 

Return Values

[1]table   administrator list table which is formatted as: {{username,lastlogin,lastip}}

 

Remarks

Return all the administrators.

 


c_AddAdminFailedIp(string strIp)

 

Parameters

[1]string   the client IP

 

Return Values

nil

 

Remarks

Add the client IP to a temp banned list when login fails.

 


c_RemoveAdminFailedIp(string strIp)

 

Parameters

[1]string   the client IP

 

Return Values

nil

 

Remarks

Remove the specified IP from banned list when login is successful, for system anti-hammer.

 


c_ClearAdminSession()

 

Parameters

nil

 

Return Values

nil

 

Remarks

Clear all the expired admin sessions.

 


c_ChangeAdminListener(int nHttpPort,bool bHttpSecure)

 

Parameters

[1]int  administration listener's port

[1]bool  use SSL/TLS? 1=yes, 0=no

 

Return Values

[1]bool  return true if administration listener is updated successfully, otherwise return false

 

Remarks

Modify the administration listener.

 


c_GetAdminIPMaskList()

 

Parameters

nil

 

Return Values

[1]table   the administrator IP mask list which is formatted as: {{ip,refuse}}

 

Remarks

Return administrator IP mask list.

 


c_SetAdminIPMaskList(table tabIpmask)

 

Parameters

[1]table   the administrator IP mask list which is formatted as: {{ip,refuse}}

 

Return Values

nil

 

Remarks

Set administrator IP mask list.

 


c_GetAdminLog()

 

Parameters

nil

 

Return Values

[1]string  admin log text

 

Remarks

Get all the admin logs.

 


c_AddAdminLog(string strLog,int nType)

 

Parameters

[1]string   the admin log text

[2]int  the admin log type: 1=normal log, 2=error log

 

Return Values

nil

 

Remarks

Add an admin log.