forked from mtusi2026/mtusi2026lab3
На 5
This commit is contained in:
@@ -39,12 +39,13 @@ func (a *authMiddleware) WithAdminAccess(next http.Handler) http.Handler {
|
||||
|
||||
func (a *authMiddleware) privateAccessCheckCallback(next http.Handler) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if _, err := a.verifySession(r); err != nil {
|
||||
data, err := a.verifySession(r)
|
||||
if err != nil {
|
||||
framework.JSONError(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
next.ServeHTTP(w, r)
|
||||
next.ServeHTTP(w, framework.WithVerifiedSession(r, data))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +62,7 @@ func (a *authMiddleware) operatorAccessCheckCallback(expectedRole role.Role, nex
|
||||
return
|
||||
}
|
||||
|
||||
next.ServeHTTP(w, r)
|
||||
next.ServeHTTP(w, framework.WithVerifiedSession(r, u))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user