build: fix mgmt and userprefs when building them separately (#1601)

move queryHasParams in common package
fixes building mgmt and userprefs separately

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
peusebiu
2023-07-10 19:40:14 +03:00
committed by GitHub
parent 94ba538e69
commit aaf03c75fc
3 changed files with 18 additions and 18 deletions
+11
View File
@@ -2,6 +2,7 @@ package common
import (
"net/http"
"net/url"
"strconv"
"strings"
"time"
@@ -82,6 +83,16 @@ func WriteData(w http.ResponseWriter, status int, mediaType string, data []byte)
_, _ = w.Write(data)
}
func QueryHasParams(values url.Values, params []string) bool {
for _, param := range params {
if !values.Has(param) {
return false
}
}
return true
}
/*
GetAuthUserFromRequestSession returns identity
and auth status if on the request's cookie session is a logged in user.