1.5. Users API

The Users API provides utility functions to manage ntopng system users.

Functions

function getUsers()

Get ntopng users information.

Return

ntopng users information.

function addUser(string username, string full_name, string password, string host_role, string allowed_networks, string allowed_interface, string host_pool_id = nil, string language = nil)

Add a new ntopng user.

Return

true on success, false otherwise.

Parameters
  • username: the user name to add.

  • full_name: a descriptive user name.

  • password: the user password.

  • host_role: the user group, should be “unprivileged” or “administrator”.

  • allowed_networks: comma separated list of allowed networks for the user. Use “0.0.0.0/0,::/0” for all networks.

  • host_pool_id: this can be used to create a Captive Portal user.

  • language: user language code.

function deleteUser(string username)

Delete a ntopng user.

Return

true on success, false otherwise.

Parameters
  • username: the user to delete.

function getAllowedNetworks()

Get a string representing the networks the current ntopng user is allowed to see.

Return

allowed networks string.

function resetUserPassword(string who, string username, string old_password, string new_password)

Reset a ntopng user password.

Note

the administrator can reset the password regardless of the old_password value.

Return

true on success, false otherwise.

Parameters
  • who: the ntopng user who is requesting the reset.

  • username: the user for the password reset.

  • old_password: the old user password.

  • new_password: the new user password.

function changeUserRole(string username, string user_role)

Change the group of a ntopng user.

Return

true on success, false otherwise.

Parameters
  • username: the target user.

  • user_role: the new group, should be “unprivileged” or “administrator”.

function changeAllowedNets(string username, string allowed_networks)

Change the allowed networks of a ntopng user.

Return

true on success, false otherwise.

Parameters
  • username: the target user.

  • allowed_networks: the new allowed networks.

function changeAllowedIfname(string username, string allowed_ifname)

Change the allowed interface name of a ntopng user.

Return

true on success, false otherwise.

Parameters
  • username: the target user.

  • allowed_ifname: the new allowed interface name for the user.

function changeUserLanguage(string username, string language)

Change the gui language of a ntopng user.

Return

true on success, false otherwise.

Parameters
  • username: the target user.

  • language: the new language code.