From 3a299584b0e77374a713e30f603afe9acdd9df98 Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 14 Dec 2015 21:52:15 +0000 Subject: [PATCH] Added ability to specify default userlevel --- doc/Extensions/Authentication.md | 1 + html/includes/authentication/radius.inc.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/doc/Extensions/Authentication.md b/doc/Extensions/Authentication.md index e32d67e02..633b8ed13 100644 --- a/doc/Extensions/Authentication.md +++ b/doc/Extensions/Authentication.md @@ -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. ``` diff --git a/html/includes/authentication/radius.inc.php b/html/includes/authentication/radius.inc.php index 113c7b660..3e2fb1641 100644 --- a/html/includes/authentication/radius.inc.php +++ b/html/includes/authentication/radius.inc.php @@ -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;