Skip to content

Commit

Permalink
Merge pull request #138 from chuhn/deny_no_group
Browse files Browse the repository at this point in the history
Deny login for LDAP user without group (fixes #137)
  • Loading branch information
mattpascoe authored Mar 7, 2024
2 parents 2b1abd3 + 4878ca3 commit f356082
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions www/include/functions_auth.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ function get_authentication($login_name='', $login_password='') {
return(array(1, $js));
}

// look for group information:
if ($conf['authtype'] == 'ldap') { // ... other constraints
$userinfo = $auth->getUserData($login_name);
if (empty($userinfo['grps'])) {
$js = "el('loginmsg').innerHTML = 'Permission denied';";
printmsg("ERROR => Login failure for {$login_name} using authtype {$conf['authtype']}: No group assigned", 0);
return(array(1, $js));
}
}

// If the password is good.. return success.
printmsg("INFO => Authentication Successful for {$login_name} using authtype: {$conf['authtype']}", 1);
return(array(0, $js));
Expand Down

0 comments on commit f356082

Please sign in to comment.