From 9bbbfbe91a2db30a564738036b2b2407266c1fe0 Mon Sep 17 00:00:00 2001 From: Chris Mann Date: Mon, 24 Jul 2023 11:05:05 +0200 Subject: [PATCH] Menu system conform / propagation CanAdmin --- admin.go | 16 +++++++++++----- home.go | 7 ++++--- invite.go | 5 +++++ login.go | 1 + profile.go | 3 +++ 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/admin.go b/admin.go index d41b318..00a417c 100644 --- a/admin.go +++ b/admin.go @@ -43,6 +43,7 @@ type AdminUsersTplData struct { UserNameAttr string UserBaseDN string Users EntryList + CanAdmin bool } func handleAdminActivateUsers(w http.ResponseWriter, r *http.Request) { @@ -153,6 +154,7 @@ type AdminGroupsTplData struct { GroupNameAttr string GroupBaseDN string Groups EntryList + CanAdmin bool } func handleAdminGroups(w http.ResponseWriter, r *http.Request) { @@ -192,6 +194,7 @@ type AdminMailingTplData struct { MailingNameAttr string MailingBaseDN string MailingLists EntryList + CanAdmin bool } func handleAdminMailing(w http.ResponseWriter, r *http.Request) { @@ -236,8 +239,9 @@ type AdminMailingListTplData struct { PossibleNewMembers EntryList AllowGuest bool - Error string - Success bool + Error string + Success bool + CanAdmin bool } func handleAdminMailingList(w http.ResponseWriter, r *http.Request) { @@ -451,8 +455,9 @@ type AdminLDAPTplData struct { ListMemGro map[string]string - Error string - Success bool + Error string + Success bool + CanAdmin bool } type EntryName struct { @@ -926,7 +931,8 @@ type CreateData struct { ObjectClass string SN string - Error string + Error string + CanAdmin bool } func handleAdminCreate(w http.ResponseWriter, r *http.Request) { diff --git a/home.go b/home.go index 76ce672..4024f16 100644 --- a/home.go +++ b/home.go @@ -7,9 +7,10 @@ package main import "net/http" type HomePageData struct { - Login *LoginStatus - BaseDN string - Org string + Login *LoginStatus + BaseDN string + Org string + CanAdmin bool } func handleHome(w http.ResponseWriter, r *http.Request) { diff --git a/invite.go b/invite.go index b5a32f6..9f906b3 100644 --- a/invite.go +++ b/invite.go @@ -44,6 +44,7 @@ type PasswordFoundData struct { Username string Mail string OtherMailbox string + CanAdmin bool } type PasswordLostData struct { @@ -52,6 +53,7 @@ type PasswordLostData struct { Username string Mail string OtherMailbox string + CanAdmin bool } func openNewUserLdap(config *ConfigFile) (*ldap.Conn, error) { @@ -204,6 +206,7 @@ type NewAccountData struct { ErrorMessage string WarningMessage string Success bool + CanAdmin bool } func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invitedBy string) bool { @@ -349,6 +352,7 @@ type SendCodeData struct { CodeDisplay string CodeSentTo string WebBaseAddress string + CanAdmin bool } type CodeMailFields struct { @@ -357,6 +361,7 @@ type CodeMailFields struct { Code string InviteFrom string WebBaseAddress string + CanAdmin bool } func handleInviteSendCode(w http.ResponseWriter, r *http.Request) { diff --git a/login.go b/login.go index 36f7236..66dc827 100644 --- a/login.go +++ b/login.go @@ -221,6 +221,7 @@ type LoginFormData struct { WrongPass bool ErrorMessage string Login bool + CanAdmin bool } func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo { diff --git a/profile.go b/profile.go index f9de490..64dce10 100644 --- a/profile.go +++ b/profile.go @@ -20,6 +20,7 @@ type ProfileTplData struct { Surname string Description string Login *LoginStatus + CanAdmin bool } //ProfilePicture string @@ -38,6 +39,7 @@ func handleProfile(w http.ResponseWriter, r *http.Request) { Login: login, ErrorMessage: "", Success: false, + CanAdmin: false, } data.Mail = login.UserEntry.GetAttributeValue("mail") @@ -127,6 +129,7 @@ type PasswdTplData struct { TooShortError bool NoMatchError bool Success bool + CanAdmin bool } func handleFoundPassword(w http.ResponseWriter, r *http.Request) {