summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/app/handler/admin/index.go')
-rw-r--r--pkg/app/handler/admin/index.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/pkg/app/handler/admin/index.go b/pkg/app/handler/admin/index.go
new file mode 100644
index 0000000..5f1f579
--- /dev/null
+++ b/pkg/app/handler/admin/index.go
@@ -0,0 +1,27 @@
+// Used to show the landing page of the application
+
+package admin
+
+import (
+ "glsamaker/pkg/app/handler/authentication"
+ "glsamaker/pkg/app/handler/authentication/utils"
+ "glsamaker/pkg/database/connection"
+ "glsamaker/pkg/models/users"
+ "net/http"
+)
+
+// Show renders a template to show the landing page of the application
+func Show(w http.ResponseWriter, r *http.Request) {
+
+ user := utils.GetAuthenticatedUser(r)
+
+ if !user.Permissions.Admin.View {
+ authentication.AccessDenied(w, r)
+ return
+ }
+
+ var users []*users.User
+ connection.DB.Model(&users).Order("email ASC").Select()
+
+ renderAdminTemplate(w, user, users)
+}