Made WithUser middleware private

This commit is contained in:
Daniel
2023-11-30 14:23:51 -08:00
parent 7558bb3f23
commit 322aa0747a
+3 -3
View File
@@ -94,7 +94,7 @@ func New(dbc *db.DB, scannr *scanner.Scanner, musicPaths []MusicPath, podcastsPa
chain := handlerutil.Chain( chain := handlerutil.Chain(
withParams, withParams,
withRequiredParams, withRequiredParams,
c.WithUser, c.withUser,
) )
c.Handle("/getLicense", chain(resp(c.ServeGetLicence))) c.Handle("/getLicense", chain(resp(c.ServeGetLicence)))
@@ -220,7 +220,7 @@ func withRequiredParams(next http.Handler) http.Handler {
}) })
} }
func (c *Controller) WithUser(next http.Handler) http.Handler { func (c *Controller) withUser(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
params := r.Context().Value(CtxParams).(params.Params) params := r.Context().Value(CtxParams).(params.Params)
// ignoring errors here, a middleware has already ensured they exist // ignoring errors here, a middleware has already ensured they exist
@@ -243,7 +243,7 @@ func (c *Controller) WithUser(next http.Handler) http.Handler {
newLDAPUser = true newLDAPUser = true
// Because the user wasn't found we can now try // Because the user wasn't found we can now try
// to use LDAP. ldapFQDN, err := c.dbc.GetSetting("ldap_fqdn") // to use LDAP.
ldapFQDN, err := c.dbc.GetSetting("ldap_fqdn") ldapFQDN, err := c.dbc.GetSetting("ldap_fqdn")
if ldapFQDN != "" && err == nil { if ldapFQDN != "" && err == nil {