Small code suggestion related to the 'remote' auth type

Relatively trivial edit, but allows the "remote" auth type to have the same functionality of looking up user access levels from database that the 'http-auth' one does. Useful if you want to have a couple of admin users, but let everyone else in as a global reader only.
-- Nathan
diff --git a/html/includes/authentication/remote.inc.php b/html/includes/authentication/remote.inc.php index 55f9a332..85a2e690 100644 --- a/html/includes/authentication/remote.inc.php +++ b/html/includes/authentication/remote.inc.php @@ -136,6 +136,12 @@ function remote_auth_user_level($username) { global $config;
+ //Attempt to look user up in DB, if something found, then return it + $tmp_level = dbFetchCell("SELECT `level` FROM `users` WHERE `username` = ? AND `type` = ?", [$username, 'mysql']); + if ( $tmp_level ) { + return $tmp_level; + } + return isset($config['auth_remote_userlevel']) ? $config['auth_remote_userlevel'] : 1; }
participants (2)
-
Adam Armstrong
-
Nathan Neulinger