From cf3f6666e09b3aaf9c16313296e2607b2ea812f6 Mon Sep 17 00:00:00 2001 From: BetaPictoris Date: Sat, 5 Aug 2023 15:19:10 -0700 Subject: [PATCH 01/64] Added LDAP link --- server/ctrladmin/adminui/pages/home.tmpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/ctrladmin/adminui/pages/home.tmpl b/server/ctrladmin/adminui/pages/home.tmpl index 27dfbc48..ded1361e 100644 --- a/server/ctrladmin/adminui/pages/home.tmpl +++ b/server/ctrladmin/adminui/pages/home.tmpl @@ -35,7 +35,9 @@ {{ end }} {{ end }} {{ if .User.IsAdmin }} -
{{ component "link" (props . "To" (path "/admin/create_user")) }}create new{{ end }}
+
{{ component "link" (props . "To" (path + "/admin/create_user")) }}create new{{ end }} {{component "link" + (props . "To" (path "/admin/ldap")) }}LDAP{{ end }}
{{ end }} {{ end }} From c5b35a6ff15dca163bdfd56c97d769769a841dd1 Mon Sep 17 00:00:00 2001 From: BetaPictoris Date: Sat, 5 Aug 2023 16:30:54 -0700 Subject: [PATCH 02/64] Added LDAP config template --- server/ctrladmin/adminui/pages/ldap.tmpl | 69 ++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 server/ctrladmin/adminui/pages/ldap.tmpl diff --git a/server/ctrladmin/adminui/pages/ldap.tmpl b/server/ctrladmin/adminui/pages/ldap.tmpl new file mode 100644 index 00000000..9a2d0dc4 --- /dev/null +++ b/server/ctrladmin/adminui/pages/ldap.tmpl @@ -0,0 +1,69 @@ +{{ component "layout" . }} +{{ component "layout_user" . }} + +{{ component "block" (props . + "Icon" "user" + "Name" "configuring LDAP" +) }} +
+ + + + + + + + + + + + + + + + + +
+{{ end }} + +{{ end }} +{{ end }} From ae9f95aa7520e7b582421a7d9ff4df08ffbe2958 Mon Sep 17 00:00:00 2001 From: BetaPictoris Date: Sat, 5 Aug 2023 16:43:03 -0700 Subject: [PATCH 03/64] Added LDAP route --- server/ctrladmin/handlers.go | 9 +++++++++ server/server.go | 1 + 2 files changed, 10 insertions(+) diff --git a/server/ctrladmin/handlers.go b/server/ctrladmin/handlers.go index 3b08bee4..5bd54b23 100644 --- a/server/ctrladmin/handlers.go +++ b/server/ctrladmin/handlers.go @@ -157,6 +157,15 @@ func (c *Controller) ServeUnlinkListenBrainzDo(r *http.Request) *Response { return &Response{redirect: "/admin/home"} } +func (c *Controller) ServeLDAPConfig(r *http.Request) *Response { + data := &templateData{} + + return &Response{ + template: "ldap.tmpl", + data: data, + } +} + func (c *Controller) ServeChangeUsername(r *http.Request) *Response { user, err := selectedUserIfAdmin(c, r) if err != nil { diff --git a/server/server.go b/server/server.go index 56d8b39a..2199c8f3 100644 --- a/server/server.go +++ b/server/server.go @@ -173,6 +173,7 @@ func setupAdmin(r *mux.Router, ctrl *ctrladmin.Controller) { routUser.Use(ctrl.WithUserSession) routUser.Handle("/logout", ctrl.HR(ctrl.ServeLogout)) // "raw" handler, updates session routUser.Handle("/home", ctrl.H(ctrl.ServeHome)) + routUser.Handle("/ldap", ctrl.H(ctrl.ServeLDAPConfig)) routUser.Handle("/change_username", ctrl.H(ctrl.ServeChangeUsername)) routUser.Handle("/change_username_do", ctrl.H(ctrl.ServeChangeUsernameDo)) routUser.Handle("/change_password", ctrl.H(ctrl.ServeChangePassword)) From 13bb999bd51a5257920b128982d4c25c12497d2b Mon Sep 17 00:00:00 2001 From: BetaPictoris Date: Sat, 5 Aug 2023 17:06:37 -0700 Subject: [PATCH 04/64] Made TLS checkbox work. TODO: Make the styles match the rest of the page and move them out of inline. --- server/ctrladmin/adminui/pages/ldap.tmpl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/ctrladmin/adminui/pages/ldap.tmpl b/server/ctrladmin/adminui/pages/ldap.tmpl index 9a2d0dc4..56a68b2d 100644 --- a/server/ctrladmin/adminui/pages/ldap.tmpl +++ b/server/ctrladmin/adminui/pages/ldap.tmpl @@ -35,13 +35,16 @@ value="389" > - - -