diff --git a/html/template/sync/sudo.html b/html/template/sync/sudo.html new file mode 100644 index 00000000..fae7566c --- /dev/null +++ b/html/template/sync/sudo.html @@ -0,0 +1,365 @@ +{{ template "sync/layout/authenticated.html" . }} + +{{ define "title" }}Dash{{ end }} +{{ define "extraheader" }} +{{ end }} +{{ define "content" }} +
+

+ Communications Testing +

+
+
+ +
+
+ SMS Testing +
+
+
+
+ + +
+
+ + +
+ +
+
+
+ + +
+
+ MMS Testing +
+
+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+
+ +
+ +
+
+ RCS Testing +
+
+
+
+ + +
+
+ + +
+
+ +
+ + +
+
+ +
+
+
+ + +
+
+ Email Testing +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+
+
+ + +
+
+ Push Notification Testing +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ + +
+ +
+
+
+ +
+ + +

+ User Impersonation +

+
+
+ Impersonate User +
+
+
+
+ +
+ + +
+
+
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
User IDNameEmailRoleActions
1001John Doejohn.doe@example.comAdmin + +
1002Jane Smithjane.smith@example.comSupport + +
1003Robert Johnsonrobert@example.comPremium User + +
1004Maria Garciamaria@example.comStandard User + +
+
+ + +
+
+
+{{ end }} diff --git a/sync/routes.go b/sync/routes.go index c0afd12c..2af70054 100644 --- a/sync/routes.go +++ b/sync/routes.go @@ -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)) diff --git a/sync/sudo.go b/sync/sudo.go new file mode 100644 index 00000000..17cbcfe3 --- /dev/null +++ b/sync/sudo.go @@ -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 +}