refactored for maintainability
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"git.haelnorr.com/h/golib/hws"
|
||||
"git.haelnorr.com/h/oslstats/internal/db"
|
||||
"git.haelnorr.com/h/oslstats/internal/roles"
|
||||
"git.haelnorr.com/h/oslstats/internal/throw"
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
@@ -17,7 +18,7 @@ func PermTester(s *hws.Server, conn *bun.DB) http.Handler {
|
||||
isAdmin, err := user.HasRole(r.Context(), tx, roles.Admin)
|
||||
tx.Rollback()
|
||||
if err != nil {
|
||||
throwInternalServiceError(s, w, r, "Error", err)
|
||||
throw.InternalServiceError(s, w, r, "Error", err)
|
||||
}
|
||||
_, _ = w.Write([]byte(strconv.FormatBool(isAdmin)))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user