mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
Added ability to specify default userlevel
This commit is contained in:
@@ -141,4 +141,5 @@ $config['radius']['port'] = '1812';
|
||||
$config['radius']['secret'] = 'testing123';
|
||||
$config['radius']['timeout'] = 3;
|
||||
$config['radius']['users_purge'] = 14;//Purge users who haven't logged in for 14 days.
|
||||
$config['radius']['default_level'] = 1;//Set the default user level when automatically creating a user.
|
||||
```
|
||||
|
||||
@@ -50,9 +50,13 @@ function auth_usermanagement() {
|
||||
|
||||
function adduser($username, $password, $level=1, $email='', $realname='', $can_modify_passwd=0, $description='', $twofactor=0) {
|
||||
// Check to see if user is already added in the database
|
||||
global $config;
|
||||
if (!user_exists($username)) {
|
||||
$hasher = new PasswordHash(8, false);
|
||||
$encrypted = $hasher->HashPassword($password);
|
||||
if ($config['radius']['default_level'] > 0) {
|
||||
$level = $config['radius']['default_level'];
|
||||
}
|
||||
$userid = dbInsert(array('username' => $username, 'password' => $encrypted, 'realname' => $realname, 'email' => $email, 'descr' => $description, 'level' => $level, 'can_modify_passwd' => $can_modify_passwd, 'twofactor' => $twofactor), 'users');
|
||||
if ($userid == false) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user