Add mock of admin area

This commit is contained in:
Eli Ribble 2026-02-18 07:07:15 +00:00
parent 7ea66dc02e
commit ec8b7b7db9
No known key found for this signature in database
3 changed files with 388 additions and 0 deletions

View file

@ -67,6 +67,7 @@ func Router() chi.Router {
r.Method("GET", "/signout", auth.NewEnsureAuth(getSignout))
r.Method("GET", "/source/{globalid}", auth.NewEnsureAuth(getSource))
r.Method("GET", "/stadia", auth.NewEnsureAuth(getStadia))
r.Method("GET", "/sudo", authenticatedHandler(getSudo))
r.Method("GET", "/trap/{globalid}", auth.NewEnsureAuth(getTrap))
r.Method("GET", "/text/{destination}", auth.NewEnsureAuth(getTextMessages))
r.Method("GET", "/upload", authenticatedHandler(getUploadList))

22
sync/sudo.go Normal file
View file

@ -0,0 +1,22 @@
package sync
import (
"context"
"net/http"
"github.com/Gleipnir-Technology/nidus-sync/db/enums"
"github.com/Gleipnir-Technology/nidus-sync/db/models"
)
type contentSudo struct{}
func getSudo(ctx context.Context, user *models.User) (string, interface{}, *errorWithStatus) {
if user.Role != enums.UserroleRoot {
return "", nil, &errorWithStatus{
Message: "You have to be a root user to access this",
Status: http.StatusForbidden,
}
}
content := contentAdminDash{}
return "sync/sudo.html", content, nil
}