Menu system conform / propagation CanAdmin
This commit is contained in:
parent
9bbbfbe91a
commit
53d323570b
5 changed files with 23 additions and 10 deletions
15
admin.go
15
admin.go
|
@ -75,6 +75,7 @@ func handleAdminActivateUsers(w http.ResponseWriter, r *http.Request) {
|
||||||
UserNameAttr: config.UserNameAttr,
|
UserNameAttr: config.UserNameAttr,
|
||||||
UserBaseDN: config.UserBaseDN,
|
UserBaseDN: config.UserBaseDN,
|
||||||
Users: EntryList(sr.Entries),
|
Users: EntryList(sr.Entries),
|
||||||
|
CanAdmin: login.CanAdmin,
|
||||||
}
|
}
|
||||||
templateAdminActivateUsers.Execute(w, data)
|
templateAdminActivateUsers.Execute(w, data)
|
||||||
|
|
||||||
|
@ -134,6 +135,7 @@ func handleAdminUsers(w http.ResponseWriter, r *http.Request) {
|
||||||
UserNameAttr: config.UserNameAttr,
|
UserNameAttr: config.UserNameAttr,
|
||||||
UserBaseDN: config.UserBaseDN,
|
UserBaseDN: config.UserBaseDN,
|
||||||
Users: EntryList(sr.Entries),
|
Users: EntryList(sr.Entries),
|
||||||
|
CanAdmin: login.CanAdmin,
|
||||||
}
|
}
|
||||||
sort.Sort(data.Users)
|
sort.Sort(data.Users)
|
||||||
|
|
||||||
|
@ -183,6 +185,7 @@ func handleAdminGroups(w http.ResponseWriter, r *http.Request) {
|
||||||
GroupNameAttr: config.GroupNameAttr,
|
GroupNameAttr: config.GroupNameAttr,
|
||||||
GroupBaseDN: config.GroupBaseDN,
|
GroupBaseDN: config.GroupBaseDN,
|
||||||
Groups: EntryList(sr.Entries),
|
Groups: EntryList(sr.Entries),
|
||||||
|
CanAdmin: login.CanAdmin,
|
||||||
}
|
}
|
||||||
sort.Sort(data.Groups)
|
sort.Sort(data.Groups)
|
||||||
|
|
||||||
|
@ -223,6 +226,7 @@ func handleAdminMailing(w http.ResponseWriter, r *http.Request) {
|
||||||
MailingNameAttr: config.MailingNameAttr,
|
MailingNameAttr: config.MailingNameAttr,
|
||||||
MailingBaseDN: config.MailingBaseDN,
|
MailingBaseDN: config.MailingBaseDN,
|
||||||
MailingLists: EntryList(sr.Entries),
|
MailingLists: EntryList(sr.Entries),
|
||||||
|
CanAdmin: login.CanAdmin,
|
||||||
}
|
}
|
||||||
sort.Sort(data.MailingLists)
|
sort.Sort(data.MailingLists)
|
||||||
|
|
||||||
|
@ -423,8 +427,9 @@ func handleAdminMailingList(w http.ResponseWriter, r *http.Request) {
|
||||||
PossibleNewMembers: possibleNewMembers,
|
PossibleNewMembers: possibleNewMembers,
|
||||||
AllowGuest: config.MailingGuestsBaseDN != "",
|
AllowGuest: config.MailingGuestsBaseDN != "",
|
||||||
|
|
||||||
Error: dError,
|
Error: dError,
|
||||||
Success: dSuccess,
|
Success: dSuccess,
|
||||||
|
CanAdmin: login.CanAdmin,
|
||||||
}
|
}
|
||||||
sort.Sort(data.Members)
|
sort.Sort(data.Members)
|
||||||
sort.Sort(data.PossibleNewMembers)
|
sort.Sort(data.PossibleNewMembers)
|
||||||
|
@ -910,8 +915,9 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
|
||||||
Groups: groups,
|
Groups: groups,
|
||||||
PossibleNewGroups: possibleNewGroups,
|
PossibleNewGroups: possibleNewGroups,
|
||||||
|
|
||||||
Error: dError,
|
Error: dError,
|
||||||
Success: dSuccess,
|
Success: dSuccess,
|
||||||
|
CanAdmin: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1099,6 +1105,7 @@ func handleAdminCreate(w http.ResponseWriter, r *http.Request) {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data.CanAdmin = true
|
||||||
|
|
||||||
templateAdminCreate.Execute(w, data)
|
templateAdminCreate.Execute(w, data)
|
||||||
}
|
}
|
||||||
|
|
7
home.go
7
home.go
|
@ -22,9 +22,10 @@ func handleHome(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
data := &HomePageData{
|
data := &HomePageData{
|
||||||
Login: login,
|
Login: login,
|
||||||
BaseDN: config.BaseDN,
|
BaseDN: config.BaseDN,
|
||||||
Org: config.Org,
|
Org: config.Org,
|
||||||
|
CanAdmin: login.CanAdmin,
|
||||||
}
|
}
|
||||||
|
|
||||||
templateHome.Execute(w, data)
|
templateHome.Execute(w, data)
|
||||||
|
|
|
@ -103,6 +103,7 @@ func handleLostPassword(w http.ResponseWriter, r *http.Request) {
|
||||||
data.Success = true
|
data.Success = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data.CanAdmin = false
|
||||||
templateLostPasswordPage.Execute(w, data)
|
templateLostPasswordPage.Execute(w, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +252,7 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi
|
||||||
} else {
|
} else {
|
||||||
data.SuggestPW = fmt.Sprintf("%s", suggestPassword())
|
data.SuggestPW = fmt.Sprintf("%s", suggestPassword())
|
||||||
}
|
}
|
||||||
|
data.CanAdmin = false
|
||||||
|
|
||||||
templateInviteNewAccount.Execute(w, data)
|
templateInviteNewAccount.Execute(w, data)
|
||||||
return data.Success
|
return data.Success
|
||||||
|
@ -411,6 +413,7 @@ func handleInviteSendCode(w http.ResponseWriter, r *http.Request) {
|
||||||
data.Success = true
|
data.Success = true
|
||||||
data.CodeDisplay = code
|
data.CodeDisplay = code
|
||||||
}
|
}
|
||||||
|
data.CanAdmin = login.CanAdmin
|
||||||
|
|
||||||
templateInviteSendCode.Execute(w, data)
|
templateInviteSendCode.Execute(w, data)
|
||||||
|
|
||||||
|
|
3
login.go
3
login.go
|
@ -228,7 +228,7 @@ func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo {
|
||||||
templateLogin := getTemplate("login.html")
|
templateLogin := getTemplate("login.html")
|
||||||
|
|
||||||
if r.Method == "GET" {
|
if r.Method == "GET" {
|
||||||
templateLogin.Execute(w, LoginFormData{})
|
templateLogin.Execute(w, LoginFormData{CanAdmin: false})
|
||||||
return nil
|
return nil
|
||||||
} else if r.Method == "POST" {
|
} else if r.Method == "POST" {
|
||||||
// log.Printf("%v", "Parsing Form handleLogin")
|
// log.Printf("%v", "Parsing Form handleLogin")
|
||||||
|
@ -250,6 +250,7 @@ func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo {
|
||||||
data := &LoginFormData{
|
data := &LoginFormData{
|
||||||
Username: username,
|
Username: username,
|
||||||
Login: false,
|
Login: false,
|
||||||
|
CanAdmin: false,
|
||||||
}
|
}
|
||||||
if ldap.IsErrorWithCode(err, ldap.LDAPResultInvalidCredentials) {
|
if ldap.IsErrorWithCode(err, ldap.LDAPResultInvalidCredentials) {
|
||||||
data.WrongPass = true
|
data.WrongPass = true
|
||||||
|
|
|
@ -39,7 +39,7 @@ func handleProfile(w http.ResponseWriter, r *http.Request) {
|
||||||
Login: login,
|
Login: login,
|
||||||
ErrorMessage: "",
|
ErrorMessage: "",
|
||||||
Success: false,
|
Success: false,
|
||||||
CanAdmin: false,
|
CanAdmin: login.CanAdmin,
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Mail = login.UserEntry.GetAttributeValue("mail")
|
data.Mail = login.UserEntry.GetAttributeValue("mail")
|
||||||
|
@ -177,6 +177,7 @@ func handleFoundPassword(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data.CanAdmin = false
|
||||||
templateFoundPasswordPage.Execute(w, data)
|
templateFoundPasswordPage.Execute(w, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,6 +217,6 @@ func handlePasswd(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data.CanAdmin = false
|
||||||
templatePasswd.Execute(w, data)
|
templatePasswd.Execute(w, data)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue