add permission definition
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-11 14:32:50 +11:00
parent 1ffa19d225
commit afec665759
6 changed files with 99 additions and 7 deletions

View File

@@ -116,7 +116,8 @@ func LoginCheck(username string, password string) (string, error) {
u := User{}
// Query database for matching user object
err = db.QueryRowx("SELECT * FROM Users WHERE Username=?", username).StructScan(&u)
// Use IFNULL to handle situation where a user might not be a member of a group
err = db.QueryRowx("SELECT UserId, IFNULL(GroupId, 0) GroupId, UserName, Password, LdapUser, Admin FROM Users WHERE Username=?", username).StructScan(&u)
if err != nil {
if err == sql.ErrNoRows {